SLP_Admin_Locations_Add
extends SLP_Base_ReactObject
in package
Prepares the React add/edit location interface.
Add-ons can continue using the slp_modify_location_add_form action. Instead of appending legacy settings HTML, action callbacks should call add_group(), add_field(), or set_map() on this singleton.
Table of Contents
Properties
- $addon : object
- $buildDir : string
- $buildURL : string
- $group_params : array<string|int, mixed>
- $myslp : MySLP
- $pageName : string
- $scriptAssetFile : string
- $scriptFile : string
- $scriptFilebase : string
- $scriptHandle : string
- $scriptURL : string
- $settings : SLP_Settings
- $slplus : SLPlus
- $uses_myslp : bool
- $uses_slplus : bool
- $pluginDir : mixed
- $pluginURL : mixed
- $slug : mixed
- $wrapper_class : mixed
- $built : bool
- $fields : array<string|int, mixed>
- $groups : array<string|int, mixed>
- $map_config : array<string|int, mixed>
Methods
- __construct() : mixed
- __get() : SLPlus_BaseClass_Object
- __isset() : bool
- add_field() : void
- Add or replace a field in the editor schema.
- add_group() : void
- Add or replace an editor group.
- build_interface() : void
- Build the editor schema and add its React portal target to the Add tab.
- extend_locations_react_vars() : array<string|int, mixed>
- Add editor data to the shared Locations React bootstrap object.
- get_instance() : static
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- map() : void
- Use the standard dynamic Google map in the editor.
- render() : void
- Render admin page - default can be overriden.
- set_map() : void
- Configure the map panel shown by the React editor.
- set_properties() : void
- Set our properties.
- enqueueReact() : void
- Things we normally want to do before each render
- get_vars_for_react() : array<string|int, mixed>
- Pass data from PHP to React JavaScript environment.
- initialize() : void
- Initialize this object.
- add_core_fields() : void
- Add the standard location fields.
- add_editor_section() : void
- Add the Add tab and its React portal target.
- add_extended_data_fields() : void
- Add every active extended-data field to the editor schema.
- get_extended_data_display_type() : string
- Resolve an extended field's React control type.
- get_extended_data_group() : array<string|int, mixed>
- Resolve the group for an extended field.
- get_map_id() : string
- Return the configured Google map ID when available.
Properties
$addon
public
object
$addon
$buildDir read-only
public
string
$buildDir
The build directory where the React script lives.
$buildURL read-only
public
string
$buildURL
The build URL where the React script lives.
$group_params
public
array<string|int, mixed>
$group_params
= array()
$myslp
public
MySLP
$myslp
$pageName
public
string
$pageName
The page name for React, update with initialize() override.
$scriptAssetFile read-only
public
string
$scriptAssetFile
The fully qualified file name for the React script supporting an asset PHP file.
$scriptFile read-only
public
string
$scriptFile
The fully qualified file name for the React script.
$scriptFilebase
public
string
$scriptFilebase
The name of the edit/view mode script file, default: script.js.
$scriptHandle
public
string
$scriptHandle
Both the WP handle for managing the React script and the build/
$scriptURL read-only
public
string
$scriptURL
The URL for the React script.
$settings
public
SLP_Settings
$settings
$slplus
public
SLPlus
$slplus
$uses_myslp
public
bool
$uses_myslp
Set to true to add a $myslp property pointing to global $myslp
$uses_slplus
public
bool
$uses_slplus
Default false try to use SLPlus::get_instance() legacy models that use $this->slplus must set this to true.
$pluginDir
protected
mixed
$pluginDir
$pluginURL
protected
mixed
$pluginURL
$slug
protected
mixed
$slug
$wrapper_class
protected
mixed
$wrapper_class
= 'dashboard-wrapper react-wrapper'
$built
private
bool
$built
= \false
$fields
private
array<string|int, mixed>
$fields
= array()
$groups
private
array<string|int, mixed>
$groups
= array()
$map_config
private
array<string|int, mixed>
$map_config
= array()
Methods
__construct()
public
__construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
__get()
public
__get(string $property) : SLPlus_BaseClass_Object
Parameters
- $property : string
Return values
SLPlus_BaseClass_Object__isset()
public
__isset(string $property) : bool
Parameters
- $property : string
Return values
booladd_field()
Add or replace a field in the editor schema.
public
add_field(array<string|int, mixed> $field) : void
Parameters
- $field : array<string|int, mixed>
-
Field schema.
add_group()
Add or replace an editor group.
public
add_group(array<string|int, mixed> $group) : void
Parameters
- $group : array<string|int, mixed>
-
Group schema with slug and label.
build_interface()
Build the editor schema and add its React portal target to the Add tab.
public
build_interface() : void
extend_locations_react_vars()
Add editor data to the shared Locations React bootstrap object.
public
extend_locations_react_vars(array<string|int, mixed> $vars) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed>
-
Existing React variables.
Return values
array<string|int, mixed>get_instance()
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
public
static get_instance([bool $no_global = false ][, mixed $params = array() ]) : static
Parameters
- $no_global : bool = false
-
set to true to skip assigning object to SLP global as a property.
- $params : mixed = array()
-
object init params
Return values
staticmap()
Use the standard dynamic Google map in the editor.
public
map() : void
render()
Render admin page - default can be overriden.
public
render() : void
Provide the DOM element where the React app will render: slp-full-page-react-app
set_map()
Configure the map panel shown by the React editor.
public
set_map(array<string|int, mixed> $config) : void
Parameters
- $config : array<string|int, mixed>
-
Map schema.
set_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : void
Parameters
- $options : array<string|int, mixed> = array()
enqueueReact()
Things we normally want to do before each render
protected
enqueueReact() : void
get_vars_for_react()
Pass data from PHP to React JavaScript environment.
protected
get_vars_for_react() : array<string|int, mixed>
Use this for one-time setup, things that are mostly static in PHP, but you need to send to JS.
Return values
array<string|int, mixed>initialize()
Initialize this object.
protected
initialize() : void
add_core_fields()
Add the standard location fields.
private
add_core_fields() : void
add_editor_section()
Add the Add tab and its React portal target.
private
add_editor_section() : void
add_extended_data_fields()
Add every active extended-data field to the editor schema.
private
add_extended_data_fields() : void
get_extended_data_display_type()
Resolve an extended field's React control type.
private
get_extended_data_display_type(mixed $data_field) : string
Parameters
- $data_field : mixed
Return values
stringget_extended_data_group()
Resolve the group for an extended field.
private
get_extended_data_group(mixed $data_field) : array<string|int, mixed>
Parameters
- $data_field : mixed
Return values
array<string|int, mixed>get_map_id()
Return the configured Google map ID when available.
private
get_map_id() : string