AccommodationTypeServicesController extends AbstractRestObjectController
in package

Table of Contents

$data  : AbstractPostData
$namespace  : string
Endpoint namespace.
$post_type  : string
Post type.
$public  : string
Controls visibility on frontend.
$rest_base  : string
Route base.
__construct()  : mixed
batch_items()  : array<string|int, mixed>
Bulk create, update and delete items.
batch_items_permissions_check()  : bool|WP_Error
Check if a given request has access batch create, update and delete items.
create_item()  : WP_Error|WP_REST_Response
Create a single item.
create_item_permissions_check()  : WP_Error|bool
Check if a given request has access to create an item.
delete_item()  : WP_REST_Response|WP_Error
Delete a single item.
delete_item_permissions_check()  : bool|WP_Error
Check if a given request has access to delete an item.
get_collection_params()  : array<string|int, mixed>
Get the query params for collections of attachments.
get_endpoint_args_for_item_schema()  : array<string|int, mixed>
Compatibility functions for WP 5.5, since custom types are not supported anymore.
get_item()  : WP_Error|WP_REST_Response
Get a single item.
get_item_permissions_check()  : WP_Error|bool
Check if a given request has access to read an item.
get_item_schema()  : array<string|int, mixed>
Get the item schema, conforming to JSON Schema of endpoint.
get_items()  : WP_Error|WP_REST_Response
Get a collection of posts.
get_items_permissions_check()  : WP_Error|bool
Check if a given request has access to read items.
get_public_batch_schema()  : array<string|int, mixed>
Get the batch schema, conforming to JSON Schema.
prepare_item_for_response()  : WP_Error|WP_REST_Response
register_routes()  : mixed
Register the routes.
update_item()  : WP_Error|WP_REST_Response
Update a single object.
update_item_permissions_check()  : WP_Error|bool
Check if a given request has access to update an item.
validate_setting_checkbox_field()  : string|WP_Error
Validate checkbox based settings.
validate_setting_image_width_field()  : string|WP_Error
Validate image_width based settings.
validate_setting_multiselect_field()  : array<string|int, mixed>|WP_Error
Validate multiselect based settings.
validate_setting_radio_field()  : string|WP_Error
Validate radio based settings.
validate_setting_select_field()  : string|WP_Error
Validate select based settings.
validate_setting_text_field()  : string
Validate a text value for a text based setting.
validate_setting_textarea_field()  : string
Validate textarea based settings.
add_additional_fields_schema()  : array<string|int, mixed>
Add the schema from additional fields to an schema array.
add_meta_query()  : array<string|int, mixed>
Add meta query.
adjust_wp_5_5_datatype_compatibility()  : mixed
Change datatypes `date-time` to string, and `mixed` to composite of all built in types. This is required for maintaining forward compatibility with WP 5.5 since custom post types are not supported anymore.
check_batch_limit()  : bool|WP_Error
Check batch limit.
delete_post()  : mixed
Delete post.
get_allowed_query_vars()  : array<string|int, mixed>
Get all the WP Query vars that are allowed for the API request.
get_normalized_rest_base()  : string
Get normalized rest base.
prepare_item_for_database()  : WP_Error|AbstractPostData
Prepare a single item for create.
prepare_items_query()  : array<string|int, mixed>
Determine the allowed query_vars for a get_items() response and prepare for WP_Query.
prepare_links()  : array<string|int, mixed>
Prepare links for the request.
prepareQuery()  : array<string|int, mixed>
Prepare objects query.

Properties

$data

protected AbstractPostData $data

$namespace

Endpoint namespace.

protected string $namespace = 'mphb/v1'

$post_type

Post type.

protected string $post_type = 'mphb_room_service'

$public

Controls visibility on frontend.

protected string $public = false

$rest_base

Route base.

protected string $rest_base = 'accommodation_types/services'

Methods

__construct()

public __construct() : mixed
Return values
mixed

batch_items()

Bulk create, update and delete items.

public batch_items(WP_REST_Request $request) : array<string|int, mixed>
Parameters
$request : WP_REST_Request

Full details about the request.

Return values
array<string|int, mixed>

Of WP_Error or WP_REST_Response.

batch_items_permissions_check()

Check if a given request has access batch create, update and delete items.

public batch_items_permissions_check(WP_REST_Request $request) : bool|WP_Error
Parameters
$request : WP_REST_Request

Full details about the request.

Return values
bool|WP_Error

create_item()

Create a single item.

public create_item(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
$request : WP_REST_Request

Full details about the request.

Return values
WP_Error|WP_REST_Response

create_item_permissions_check()

Check if a given request has access to create an item.

public create_item_permissions_check(WP_REST_Request $request) : WP_Error|bool
Parameters
$request : WP_REST_Request

Full details about the request.

Return values
WP_Error|bool

delete_item()

Delete a single item.

public delete_item(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
$request : WP_REST_Request

Full details about the request.

Return values
WP_REST_Response|WP_Error

delete_item_permissions_check()

Check if a given request has access to delete an item.

public delete_item_permissions_check(WP_REST_Request $request) : bool|WP_Error
Parameters
$request : WP_REST_Request

Full details about the request.

Return values
bool|WP_Error

get_collection_params()

Get the query params for collections of attachments.

public get_collection_params() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_endpoint_args_for_item_schema()

Compatibility functions for WP 5.5, since custom types are not supported anymore.

public get_endpoint_args_for_item_schema([string $method = WP_REST_Server::CREATABLE ]) : array<string|int, mixed>

See @link https://core.trac.wordpress.org/changeset/48306

Parameters
$method : string = WP_REST_Server::CREATABLE

Optional. HTTP method of the request.

Return values
array<string|int, mixed>

Endpoint arguments.

get_item()

Get a single item.

public get_item(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
$request : WP_REST_Request

Full details about the request.

Return values
WP_Error|WP_REST_Response

get_item_permissions_check()

Check if a given request has access to read an item.

public get_item_permissions_check(WP_REST_Request $request) : WP_Error|bool
Parameters
$request : WP_REST_Request

Full details about the request.

Return values
WP_Error|bool

get_item_schema()

Get the item schema, conforming to JSON Schema of endpoint.

public get_item_schema() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_items()

Get a collection of posts.

public get_items(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
$request : WP_REST_Request

Full details about the request.

Return values
WP_Error|WP_REST_Response

get_items_permissions_check()

Check if a given request has access to read items.

public get_items_permissions_check(WP_REST_Request $request) : WP_Error|bool
Parameters
$request : WP_REST_Request

Full details about the request.

Return values
WP_Error|bool

get_public_batch_schema()

Get the batch schema, conforming to JSON Schema.

public get_public_batch_schema() : array<string|int, mixed>
Return values
array<string|int, mixed>

prepare_item_for_response()

public prepare_item_for_response(mixed $object, WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
$object : mixed
$request : WP_REST_Request
Return values
WP_Error|WP_REST_Response

register_routes()

Register the routes.

public register_routes() : mixed
Return values
mixed

update_item()

Update a single object.

public update_item(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
$request : WP_REST_Request

Full details about the request.

Return values
WP_Error|WP_REST_Response

update_item_permissions_check()

Check if a given request has access to update an item.

public update_item_permissions_check(WP_REST_Request $request) : WP_Error|bool
Parameters
$request : WP_REST_Request

Full details about the request.

Return values
WP_Error|bool

validate_setting_checkbox_field()

Validate checkbox based settings.

public validate_setting_checkbox_field(string $value, array<string|int, mixed> $setting) : string|WP_Error
Parameters
$value : string

Value.

$setting : array<string|int, mixed>

Setting.

Return values
string|WP_Error

validate_setting_image_width_field()

Validate image_width based settings.

public validate_setting_image_width_field(array<string|int, mixed> $values, array<string|int, mixed> $setting) : string|WP_Error
Parameters
$values : array<string|int, mixed>

Values.

$setting : array<string|int, mixed>

Setting.

Return values
string|WP_Error

validate_setting_multiselect_field()

Validate multiselect based settings.

public validate_setting_multiselect_field(array<string|int, mixed> $values, array<string|int, mixed> $setting) : array<string|int, mixed>|WP_Error
Parameters
$values : array<string|int, mixed>

Values.

$setting : array<string|int, mixed>

Setting.

Return values
array<string|int, mixed>|WP_Error

validate_setting_radio_field()

Validate radio based settings.

public validate_setting_radio_field(string $value, array<string|int, mixed> $setting) : string|WP_Error
Parameters
$value : string

Value.

$setting : array<string|int, mixed>

Setting.

Return values
string|WP_Error

validate_setting_select_field()

Validate select based settings.

public validate_setting_select_field(string $value, array<string|int, mixed> $setting) : string|WP_Error
Parameters
$value : string

Value.

$setting : array<string|int, mixed>

Setting.

Return values
string|WP_Error

validate_setting_text_field()

Validate a text value for a text based setting.

public validate_setting_text_field(string $value, array<string|int, mixed> $setting) : string
Parameters
$value : string

Value.

$setting : array<string|int, mixed>

Setting.

Return values
string

validate_setting_textarea_field()

Validate textarea based settings.

public validate_setting_textarea_field(string $value, array<string|int, mixed> $setting) : string
Parameters
$value : string

Value.

$setting : array<string|int, mixed>

Setting.

Return values
string

add_additional_fields_schema()

Add the schema from additional fields to an schema array.

protected add_additional_fields_schema(array<string|int, mixed> $schema) : array<string|int, mixed>

The type of object is inferred from the passed schema.

Parameters
$schema : array<string|int, mixed>

Schema array.

Return values
array<string|int, mixed>

add_meta_query()

Add meta query.

protected add_meta_query(array<string|int, mixed> $args, array<string|int, mixed> $meta_query) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>

Query args.

$meta_query : array<string|int, mixed>

Meta query.

Return values
array<string|int, mixed>

adjust_wp_5_5_datatype_compatibility()

Change datatypes `date-time` to string, and `mixed` to composite of all built in types. This is required for maintaining forward compatibility with WP 5.5 since custom post types are not supported anymore.

protected adjust_wp_5_5_datatype_compatibility(array<string|int, mixed> $endpoint_args) : mixed

See @link https://core.trac.wordpress.org/changeset/48306

We still use the 'mixed' type, since if we convert to composite type everywhere, it won't work in 5.4 anymore because they require to define the full schema.

Parameters
$endpoint_args : array<string|int, mixed>

Schema with datatypes to convert.

Return values
mixed

Schema with converted datatype.

check_batch_limit()

Check batch limit.

protected check_batch_limit(array<string|int, mixed> $items) : bool|WP_Error
Parameters
$items : array<string|int, mixed>

Request items.

Return values
bool|WP_Error

delete_post()

Delete post.

protected delete_post(WP_Post $post) : mixed
Parameters
$post : WP_Post

Post object.

Return values
mixed

get_allowed_query_vars()

Get all the WP Query vars that are allowed for the API request.

protected get_allowed_query_vars() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_normalized_rest_base()

Get normalized rest base.

protected get_normalized_rest_base() : string
Return values
string

prepare_item_for_database()

Prepare a single item for create.

protected prepare_item_for_database(WP_REST_Request $request) : WP_Error|AbstractPostData
Parameters
$request : WP_REST_Request

Request object.

Return values
WP_Error|AbstractPostData

$data

prepare_items_query()

Determine the allowed query_vars for a get_items() response and prepare for WP_Query.

protected prepare_items_query([array<string|int, mixed> $prepared_args = array() ][, WP_REST_Request $request = null ]) : array<string|int, mixed>
Parameters
$prepared_args : array<string|int, mixed> = array()

Prepared arguments.

$request : WP_REST_Request = null

Request object.

Return values
array<string|int, mixed>

$query_args

Prepare links for the request.

protected prepare_links(object $object, WP_REST_Request $request) : array<string|int, mixed>
Parameters
$object : object
$request : WP_REST_Request

Request object.

Return values
array<string|int, mixed>

prepareQuery()

Prepare objects query.

protected prepareQuery(WP_REST_Request $request) : array<string|int, mixed>
Parameters
$request : WP_REST_Request

Full details about the request.

Tags
since
4.1.1
Return values
array<string|int, mixed>

Search results