pfeifferNet

Form_Print_Selector extends Form
in package

Print content selection form.

Tags
since
5.4.0
since
5.5.0

Inherit standard form class.

uses
Form

Table of Contents

Constants

EXTRA_VALIDATION_HOOK  = 'pnet_validation'
The extra_validation hook base name.
FORM_ACTION  = 'print_selection'
The admin_post hook action properties for content selector form.
FORM_CONTAINER  = 'form-print-selector.php'
Form container partial.
FORM_NAME  = 'print_selector'
The name attribute of the form.
NEXT_PAGE  = ''
The page to redirect to when closing form response banner.
NONCE_ACTION  = 'select_content'
The content selector nonce action.
NONCE_NAME  = 'token'
The nonce name.
RESPONSE_PAGE  = 'printing'
The page to redirect to for form submission response.

Properties

$form_container  : string
The fully qualified path to the form container partial.
$form_header  : string
The text before 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.
$messages  : Messages
The instance of the Messages class.
$next_url  : string
The fully qualified path to the next page after closing the success banner.
$notifications  : array<string|int, string>
The marked up notifications to display at top of form.
$print_page_url  : string
The print page URL.
$progress_container  : string
The progress indicator container markup.
$recaptcha_site_key  : string
Google reCAPTCHA V3 site key.
$response_url  : string
The fully qualified path to the submission response target.
$success_message_code  : string
The success message code.
$validation_hook  : string
The name of the extra validation hook.

Methods

get_form_action()  : string
Return the form action.
get_instance()  : object
Creates and/or returns the instance of this class.
get_validation_hook()  : string
Return the extra validation hook name.
handle_submission()  : void
Handle the form submission.
render()  : void
Render the form.
__construct()  : void
Initialise the class and set its properties.
add_notifications()  : void
Add conditional notifications to form.
do_intercepts()  : void
Take special actions before initialising the form.
do_submission()  : void
Execute the submission request.
enqueue_assets()  : void
Enqueue the form script and styles.
render_success_notification()  : void
Render the success notification.
set_form_header()  : void
Set the form header text.
set_form_values()  : void
Initialise the values used in the form.
validate_submission()  : WP_Error
Validate the submitted form contents.

Constants

EXTRA_VALIDATION_HOOK

The extra_validation hook base name.

protected string EXTRA_VALIDATION_HOOK = 'pnet_validation'
Tags
since
5.8.0

FORM_ACTION

The admin_post hook action properties for content selector form.

protected string FORM_ACTION = 'print_selection'
Tags
since
5.4.0

FORM_CONTAINER

Form container partial.

protected string FORM_CONTAINER = 'form-print-selector.php'
Tags
since
5.4.0

NEXT_PAGE

The page to redirect to when closing form response banner.

protected string NEXT_PAGE = ''
  • Override this constant in the child class.
  • Page name must start with a slash to be appended to home_url().
Tags
since
6.4.0

NONCE_ACTION

The content selector nonce action.

protected string NONCE_ACTION = 'select_content'
Tags
since
5.4.0

NONCE_NAME

The nonce name.

protected string NONCE_NAME = 'token'
Tags
since
5.5.0

RESPONSE_PAGE

The page to redirect to for form submission response.

protected string RESPONSE_PAGE = 'printing'
Tags
since
5.5.0

Properties

$form_container

The fully qualified path to the form container partial.

protected string $form_container = ''
Tags
since
5.5.0

$form_header

The text before the form.

protected string $form_header = ''
  • This is the text to display between the page content and the form.
  • Describes the required field markup.
  • Set in set_form_header() to allow translation.
Tags
since
6.0.0

$http_handler

The instance of the HTTP_Handler class.

protected HTTP_Handler $http_handler
Tags
since
5.8.0

$instances

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

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

$messages

The instance of the Messages class.

protected Messages $messages
Tags
since
5.8.0

$next_url

The fully qualified path to the next page after closing the success banner.

protected string $next_url = ''
  • Blank means no redirection.
Tags
since
6.4.0

$notifications

The marked up notifications to display at top of form.

protected array<string|int, string> $notifications = array()
Tags
since
5.5.0

$progress_container

The progress indicator container markup.

protected string $progress_container = ''
Tags
since
6.0.0

$recaptcha_site_key

Google reCAPTCHA V3 site key.

protected string $recaptcha_site_key = ''
Tags
since
5.6.0

$response_url

The fully qualified path to the submission response target.

protected string $response_url = ''
Tags
since
5.5.0

$success_message_code

The success message code.

protected string $success_message_code = ''
  • This is the key to the success message from the message handler.
  • It is of the form "success_{FORM_ACTION}"
Tags
since
5.8.0

$validation_hook

The name of the extra validation hook.

protected string $validation_hook = ''
  • This adds the FORM_ACTION to the EXTRA_VALIDATION_HOOK constant.
Tags
since
5.8.0

Methods

get_form_action()

Return the form action.

public get_form_action() : string
  • This is the {action} part of the admin_post hook.
Tags
since
5.5.0
Return values
string

The form action.

get_instance()

Creates and/or returns the instance of this class.

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

The instance of this class.

get_validation_hook()

Return the extra validation hook name.

public get_validation_hook() : string
Tags
since
5.8.0
Return values
string

The hook name.

add_notifications()

Add conditional notifications to form.

protected add_notifications([array<string|int, string> $get_vars = array() ]) : void
  • (Maybe) override this in child classes to set specific form notifications.
Parameters
$get_vars : array<string|int, string> = array()

The sanitised $_GET arguments.

Tags
since
5.8.0

do_intercepts()

Take special actions before initialising the form.

protected do_intercepts([array<string|int, string> $get_vars = array() ]) : void
  • (Maybe) override this in child classes to set specific intercept actions.
Parameters
$get_vars : array<string|int, string> = array()

{ The sanitised $_GET arguments, including a nonce. @type string $action The action to take. }

Tags
since
5.8.0

do_submission()

Execute the submission request.

protected do_submission(WP_Error $errors, array<string|int, string> $post_vars, array<string|int, string> $server_vars) : void
Parameters
$errors : WP_Error

The WP_Error object to use if errors.

$post_vars : array<string|int, string>

The sanitised $_POST arguments.

$server_vars : array<string|int, string>

The sanitised $_SERVER arguments.

Tags
since
5.5.0

enqueue_assets()

Enqueue the form script and styles.

protected enqueue_assets() : void
  • Extend this in child classes using parent::enqueue_assets() then add more assets.
  • See class-form-user-account.php for example and setting inline scripts.
Tags
since
5.6.0

set_form_header()

Set the form header text.

protected set_form_header() : void
  • (Maybe) extend this in child classes to set specific instructions for that form.
Tags
since
6.0.0

set_form_values()

Initialise the values used in the form.

protected set_form_values(array<string|int, string> $get_vars, array<string|int, string> $server_vars) : void
  • This MUST be overridden in child classes.
Parameters
$get_vars : array<string|int, string>

The sanitised $_GET arguments.

$server_vars : array<string|int, string>

The sanitised $_SERVER arguments.

Tags
since
5.5.0

validate_submission()

Validate the submitted form contents.

protected validate_submission(WP_Error $errors, array<string|int, string> $post_vars, array<string|int, string> $server_vars) : WP_Error
  • This MUST be overridden in child classes.
Parameters
$errors : WP_Error

The WP_Error object to use if errors.

$post_vars : array<string|int, string>

The sanitised $_POST arguments.

$server_vars : array<string|int, string>

The sanitised $_SERVER arguments.

Tags
since
5.5.0
Return values
WP_Error

The maybe modified WP_Error object.


        
On this page

Search results