SLP® phpDocs

SLP_Base_ReactObject extends SLPlus_BaseClass_Object
in package

Base object used for React driven components.

Table of Contents

Properties

$addon  : object
$myslp  : MySLP
$slplus  : SLPlus
$uses_myslp  : bool
$pageName  : mixed
$pluginDir  : mixed
$pluginURL  : mixed
$scriptFilebase  : mixed
$scriptHandle  : mixed
$slug  : mixed
$uses_slplus  : mixed
$wrapper_class  : mixed
$buildDir  : mixed
$buildURL  : mixed
$scriptAssetFile  : mixed
$scriptFile  : mixed
$scriptURL  : mixed

Methods

__construct()  : mixed
__get()  : SLPlus_BaseClass_Object
__isset()  : bool
get_instance()  : static
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
render()  : void
Render admin page - default can be overriden.
set_properties()  : mixed
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
On invocation
getPlugindDir()  : string
Retrieves the build directory path for the plugin or add-on.
getPluginURL()  : string
Retrieves the build URL for the plugin or addon.

Properties

$uses_myslp

public bool $uses_myslp

Set to true to add a $myslp property pointing to global $myslp

Methods

__construct()

public __construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
$options : array<string|int, mixed> = array()

__isset()

public __isset(string $property) : bool
Parameters
$property : string
Return values
bool

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
static

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_properties()

Set our properties.

public set_properties([array<string|int, mixed> $options = array() ]) : mixed
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>

getPlugindDir()

Retrieves the build directory path for the plugin or add-on.

private getPlugindDir() : string

If the plugin directory is not already set, it assigns a value based on the slug or the add-on directory.

Return values
string

The build directory path.

getPluginURL()

Retrieves the build URL for the plugin or addon.

private getPluginURL() : string

If the plugin URL is not already set, it initializes it based on the slug. If the slug is empty, it defaults to the main plugin URL; otherwise, it uses the associated addon URL.

Return values
string

The build URL for the plugin or addon.


        
On this page

Search results