pfeifferNet

Form_Send_Email extends Tool
in package

Admin send email form functionality.

  • Add tab and form to pNet tools page.
  • Handle AJAX submission.
  • Provide the ability to bulk mail to users by role.
Tags
since
6.0.0
since
6.1.0

Inherit from Tool class.

uses
HTTP_Handler
uses
Send_Email
uses
Settings
uses
Tool

Table of Contents

Constants

ACTION  = 'pnet_send_email'
The nonce action.
CAPABILITY  = 'manage_options'
The user capability required to run this tool.
FORM_NAME  = 'send_email'
The name attribute of the form.
HANDLER  = 'sendEmail'
The name of the javascript handler for the form.
NONCE_NAME  = 'token'
The nonce name for the form.
TARGET_TAB  = 'email'
Target tools page tab for this tool.
TOOL_CONTAINER  = 'form-send-email.php'
Form container partial.

Properties

$attachments_dir  : string
The fully qualified path to the attachments folder.
$form_vars  : array<string|int, mixed>
The variables used to render the form.
$http_handler  : HTTP_Handler
The instance of the HTTP_Handler class.
$instances  : array<string|int, object>
The array of instances of this class and sub-classes.
$send_email  : Send_Email
The instance of the Send_Email class.
$tool_container  : string
Fully qualified path to the tool container partial.

Methods

get_action()  : string
Return the action name.
get_instance()  : object
Creates and/or returns the instance of this class.
handle_ajax_request()  : void
The AJAX call handler.
render()  : void
Render the tool.
set_tab()  : array<string|int, mixed>
Create the target tab on the tools page if it doesn't exist.
__construct()  : void
Initialise the class.
get_select_options()  : string
Populate the select options for the email recipients.
get_tab_name()  : string
Return the tab name.
init_tool()  : void
Initialise the tool form with required values and assets.

Constants

CAPABILITY

The user capability required to run this tool.

protected string CAPABILITY = 'manage_options'
  • Override this in sub-class if needed.
Tags
since
6.1.0

FORM_NAME

The name attribute of the form.

protected string FORM_NAME = 'send_email'
Tags
since
6.0.0

HANDLER

The name of the javascript handler for the form.

protected string HANDLER = 'sendEmail'
Tags
since
6.0.0

NONCE_NAME

The nonce name for the form.

protected string NONCE_NAME = 'token'
Tags
since
6.1.0

TARGET_TAB

Target tools page tab for this tool.

protected string TARGET_TAB = 'email'
  • This will be created if it doesn't exist.
Tags
since
6.0.0

TOOL_CONTAINER

Form container partial.

protected string TOOL_CONTAINER = 'form-send-email.php'
Tags
since
6.0.0

Properties

$attachments_dir

The fully qualified path to the attachments folder.

protected string $attachments_dir = ''
Tags
since
6.0.0

$form_vars

The variables used to render the form.

protected array<string|int, mixed> $form_vars = array('title' => '', 'description' => '')
  • Each tool may have its own set of variables other than these.

{ Array of variables used to render the form. @type string $title The title of the form. @type string $description The description for the form. }

Tags
since
6.1.0

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
6.1.0

$tool_container

Fully qualified path to the tool container partial.

protected string $tool_container = ''
Tags
since
6.1.0

Methods

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
6.1.0
Return values
object

The instance of this class.

render()

Render the tool.

public render([string $tab = '' ]) : void
  • The priority set on this hook will determine the tool sequence down the page.
Parameters
$tab : string = ''

The slug of the active tab on tools page.

Tags
since
6.1.0
see
Tools::render()

set_tab()

Create the target tab on the tools page if it doesn't exist.

public set_tab([array<string|int, mixed> $tabs = array() ]) : array<string|int, mixed>
  • The priority set on this hook will determine the tab sequence across the page.
Parameters
$tabs : array<string|int, mixed> = array()

A set of key/value pairs for the admin tools page.

Tags
since
6.1.0
see
Tools::render()
Return values
array<string|int, mixed>

The (maybe) modified tabs array.

get_select_options()

Populate the select options for the email recipients.

protected get_select_options() : string
Tags
since
6.0.0
Return values
string

The select options for the email dropdown.

get_tab_name()

Return the tab name.

protected get_tab_name() : string
Tags
since
6.1.0
Return values
string

The display name of the tab for this tool.

init_tool()

Initialise the tool form with required values and assets.

protected init_tool() : void
Tags
since
6.1.0
since
6.3.0

Use the Settings class.

uses
Settings::get()

        
On this page

Search results