SLP_REST_Locations_Manager
extends SLPlus_BaseClass_Object
in package
Authenticated REST adapter for the Locations management grid.
The adapter deliberately runs the existing admin action and display hooks. This keeps the behavior supplied by the SLP modules in sync while React owns the table presentation.
Table of Contents
Properties
- $addon : object
- $myslp : MySLP
- $slplus : SLPlus
- $uses_myslp : bool
- $uses_slplus : bool
- $slug : mixed
- $routes_registered : array<string|int, mixed>
Methods
- __construct() : mixed
- __get() : SLPlus_BaseClass_Object
- __isset() : bool
- get_grid_state() : WP_REST_Response
- Return the current user's saved locations-grid state.
- get_instance() : static
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- get_locations() : WP_REST_Response
- Return a page of locations for the management grid.
- process_bulk_action() : WP_Error|WP_REST_Response
- Process one of the existing Locations bulk actions through REST.
- register_routes() : void
- Register management routes for an API version.
- set_properties() : void
- Set our properties.
- update_grid_state() : WP_Error|WP_REST_Response
- Validate and save the current user's locations-grid state.
- user_can_manage_slp() : bool
- Check the SLP management capability.
- initialize() : mixed
- Do these things when this object is invoked. Override in your class.
- bootstrap_admin_locations() : array<string|int, mixed>
- Prepare the legacy admin environment used by the module hooks.
- get_allowed_bulk_actions() : array<string|int, mixed>
- Read the action list after all active modules have extended it.
- get_grid_state_meta_key() : string
- Get the prefixed user-meta key for saved grid state.
- normalize_filter_operator() : string
- Return a DataGrid-compatible spelling for an allowed string filter operator.
- normalize_query_params() : array<string|int, mixed>
- Convert REST query parameters to their legacy manage-locations equivalents.
- restore_request_globals() : void
- Restore globals after adapting the legacy action layer.
- sanitize_grid_filter_value() : array<string|int, mixed>|bool|float|int|string
- Sanitize a scalar or list filter value without retaining arbitrary objects.
- sanitize_grid_state() : array<string|int, mixed>|WP_Error
- Validate the intentionally limited subset of DataGrid state that we persist.
- sanitize_string_list() : array<string|int, mixed>
- Sanitize a query string list.
Properties
$addon
public
object
$addon
$myslp
public
MySLP
$myslp
$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
Set to true (default) if the object needs access to the SLPlus plugin object.
$slug
protected
mixed
$slug
$routes_registered
private
array<string|int, mixed>
$routes_registered
= 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
boolget_grid_state()
Return the current user's saved locations-grid state.
public
get_grid_state() : WP_REST_Response
Return values
WP_REST_Responseget_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
staticget_locations()
Return a page of locations for the management grid.
public
get_locations(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Tags
Return values
WP_REST_Responseprocess_bulk_action()
Process one of the existing Locations bulk actions through REST.
public
process_bulk_action(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_Error|WP_REST_Responseregister_routes()
Register management routes for an API version.
public
register_routes(string $version) : void
Parameters
- $version : string
-
REST API version.
set_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : void
Parameters
- $options : array<string|int, mixed> = array()
update_grid_state()
Validate and save the current user's locations-grid state.
public
update_grid_state(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_Error|WP_REST_Responseuser_can_manage_slp()
Check the SLP management capability.
public
user_can_manage_slp() : bool
Return values
boolinitialize()
Do these things when this object is invoked. Override in your class.
protected
initialize() : mixed
bootstrap_admin_locations()
Prepare the legacy admin environment used by the module hooks.
private
bootstrap_admin_locations(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
Return values
array<string|int, mixed> —Original request globals.
get_allowed_bulk_actions()
Read the action list after all active modules have extended it.
private
get_allowed_bulk_actions() : array<string|int, mixed>
Return values
array<string|int, mixed>get_grid_state_meta_key()
Get the prefixed user-meta key for saved grid state.
private
get_grid_state_meta_key() : string
Return values
stringnormalize_filter_operator()
Return a DataGrid-compatible spelling for an allowed string filter operator.
private
normalize_filter_operator(string $operator) : string
Parameters
- $operator : string
Return values
stringnormalize_query_params()
Convert REST query parameters to their legacy manage-locations equivalents.
private
normalize_query_params(WP_REST_Request $request) : array<string|int, mixed>
Parameters
- $request : WP_REST_Request
Return values
array<string|int, mixed>restore_request_globals()
Restore globals after adapting the legacy action layer.
private
restore_request_globals(array<string|int, mixed> $original) : void
Parameters
- $original : array<string|int, mixed>
sanitize_grid_filter_value()
Sanitize a scalar or list filter value without retaining arbitrary objects.
private
sanitize_grid_filter_value(mixed $value) : array<string|int, mixed>|bool|float|int|string
Parameters
- $value : mixed
Return values
array<string|int, mixed>|bool|float|int|stringsanitize_grid_state()
Validate the intentionally limited subset of DataGrid state that we persist.
private
sanitize_grid_state(array<string|int, mixed> $state) : array<string|int, mixed>|WP_Error
Parameters
- $state : array<string|int, mixed>
Return values
array<string|int, mixed>|WP_Errorsanitize_string_list()
Sanitize a query string list.
private
sanitize_string_list(mixed $values) : array<string|int, mixed>
Parameters
- $values : mixed