Automattic\WooCommerce\Admin\API
MarketingRecommendations::get_item_schema
Retrieves the item's schema, conforming to JSON Schema.
Method of the class: MarketingRecommendations{}
No Hooks.
Returns
Array. Item schema data.
Usage
$MarketingRecommendations = new MarketingRecommendations(); $MarketingRecommendations->get_item_schema();
MarketingRecommendations::get_item_schema() MarketingRecommendations::get item schema code WC 10.7.0
public function get_item_schema() {
$schema = [
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'marketing_recommendation',
'type' => 'object',
'properties' => [
'title' => [
'type' => 'string',
'context' => [ 'view' ],
'readonly' => true,
],
'description' => [
'type' => 'string',
'context' => [ 'view' ],
'readonly' => true,
],
'url' => [
'type' => 'string',
'context' => [ 'view' ],
'readonly' => true,
],
'direct_install' => [
'type' => 'string',
'context' => [ 'view' ],
'readonly' => true,
],
'icon' => [
'type' => 'string',
'context' => [ 'view' ],
'readonly' => true,
],
'product' => [
'type' => 'string',
'context' => [ 'view' ],
'readonly' => true,
],
'plugin' => [
'type' => 'string',
'context' => [ 'view' ],
'readonly' => true,
],
'categories' => [
'type' => 'array',
'context' => [ 'view' ],
'readonly' => true,
'items' => [
'type' => 'string',
],
],
'subcategories' => [
'type' => 'array',
'context' => [ 'view' ],
'readonly' => true,
'items' => [
'type' => 'object',
'context' => [ 'view' ],
'readonly' => true,
'properties' => [
'slug' => [
'type' => 'string',
'context' => [ 'view' ],
'readonly' => true,
],
'name' => [
'type' => 'string',
'context' => [ 'view' ],
'readonly' => true,
],
],
],
],
'tags' => [
'type' => 'array',
'context' => [ 'view' ],
'readonly' => true,
'items' => [
'type' => 'object',
'context' => [ 'view' ],
'readonly' => true,
'properties' => [
'slug' => [
'type' => 'string',
'context' => [ 'view' ],
'readonly' => true,
],
'name' => [
'type' => 'string',
'context' => [ 'view' ],
'readonly' => true,
],
],
],
],
],
];
return $this->add_additional_fields_schema( $schema );
}