pfeifferNet

Settings_Import_Export extends Tool
in package

AbstractYes

Functionality to support json settings file import/export.

  • Add tab and form to pNet tools page.
  • AJAX interaction must be handled in sub-classes.
Tags
since
6.0.0
since
6.2.0

Extend admin tool class.

uses
Settings
uses
Tool
used-by
Settings_Export
used-by
Settings_Import

Table of Contents

Constants

ACTION  = ''
The wp_ajax hook action properties.
CAPABILITY  = 'manage_options'
The user capability required to run this tool.
FORM_NAME  = ''
The name attribute of the form.
HANDLER  = ''
The name of the javascript handler for the form.
NONCE_NAME  = 'token'
The nonce name for the form.
TARGET_TAB  = 'transfer'
Target tools page tab for this tool.
TOOL_CONTAINER  = ''
Tool container partial.

Properties

$form_vars  : array<string|int, mixed>
The variables used to render the form.
$instances  : array<string|int, object>
The array of instances of this class and sub-classes.
$options_handler  : Settings
The instance of the Settings 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_tab_name()  : string
Return the tab name.
init_tool()  : void
Initialise the tool form with required values and assets.

Constants

ACTION

The wp_ajax hook action properties.

protected string ACTION = ''
  • This MUST be set in the sub-class.
Tags
since
6.1.0

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 = ''
  • This MUST be set in the sub-class.
Tags
since
6.1.0

HANDLER

The name of the javascript handler for the form.

protected string HANDLER = ''
  • This MUST be set in the sub-class.
Tags
since
6.1.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 = 'transfer'
  • This will be created if it doesn't exist.
Tags
since
6.0.0

TOOL_CONTAINER

Tool container partial.

protected string TOOL_CONTAINER = ''
  • This MUST be set in the sub-class.
Tags
since
6.1.0

Properties

$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.

handle_ajax_request()

The AJAX call handler.

public handle_ajax_request() : void
  • This method MUST be overridden in the sub-class.
Tags
since
6.1.0

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_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
  • This method MUST be overridden in the sub-class.
Tags
since
6.1.0

        
On this page

Search results