LLMS_REST_Memberships_Controller::get_item_schema()
Get the Membership’s schema, conforming to JSON Schema.
Return Return
(array)
Source Source
File: libraries/lifterlms-rest/includes/server/class-llms-rest-memberships-controller.php
* @since 1.0.0-beta.9 * * @param array $filters Array of filters to be removed. * @param LLMS_Membership $membership Membership object. */ return apply_filters( 'llms_rest_llms_membership_filters_removed_for_response', $filters, $membership ); } /** * Get the Membership's schema, conforming to JSON Schema. * * @since 1.0.0-beta.27 * * @return array */ protected function get_item_schema_base() { $schema = (array) parent::get_item_schema_base(); $schema['properties']['auto_enroll'] = array( 'description' => __( 'List of courses to automatically enroll students into when they\'re enrolled into the membership.', 'lifterlms' ), 'type' => 'array', 'default' => array(), 'items' => array( 'type' => 'integer', ), ); $schema['properties']['catalog_visibility'] = array( 'description' => __( 'Visibility of the membership in catalogs and search results.', 'lifterlms' ), 'type' => 'string', 'enum' => array_keys( llms_get_product_visibility_options() ), 'default' => 'catalog_search', 'context' => array( 'view', 'edit' ), ); $schema['properties']['categories'] = array( 'description' => __( 'List of membership categories.', 'lifterlms' ), 'type' => 'array', 'items' => array( 'type' => 'integer', ), 'context' => array( 'view', 'edit' ), ); $schema['properties']['instructors'] = array( 'description' => __( 'List of post instructors. Defaults to current user when creating a new post.', 'lifterlms' ), 'type' => 'array', 'items' => array( 'type' => 'integer', ), 'arg_options' => array( 'validate_callback' => 'llms_validate_instructors', ), 'context' => array( 'view', 'edit' ), ); $schema['properties']['restriction_action'] = array( 'description' => __( 'Determines the action to take when content restricted by the membership is accessed by a non-member. - `none`: Remain on page and display the message `restriction_message`. - `membership`: Redirect to the membership\'s permalink. - `page`: Redirect to the permalink of the page identified by `restriction_page_id`. - `custom`: Redirect to the URL identified by `restriction_url`.', 'lifterlms' ), 'type' => 'string', 'default' => 'none', 'enum' => array( 'none', 'membership', 'page', 'custom' ), 'context' => array( 'view', 'edit' ), ); $schema['properties']['restriction_message'] = array( 'description' => __( 'Message to display to non-members after a `restriction_action` redirect. When `restriction_action` is `none` replaces the page content with this message.', 'lifterlms' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'arg_options' => array( 'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database(). 'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database(). ), 'properties' => array( 'raw' => array( 'description' => __( 'Raw message content.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'edit' ), ), 'rendered' => array( 'description' => __( 'Rendered message content.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), 'default' => __( 'You must belong to the [lifterlms_membership_link id="{{membership_id}}"] membership to access this content.', 'lifterlms' ), ); $schema['properties']['restriction_page_id'] = array( 'description' => __( 'WordPress page ID used for redirecting non-members when `restriction_action` is `page`.', 'lifterlms' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'absint', ), ); $schema['properties']['restriction_url'] = array( 'description' => __( 'URL used for redirecting non-members when `restriction_action` is `custom`.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'format' => 'uri', 'arg_options' => array( 'sanitize_callback' => 'esc_url_raw', ), ); $schema['properties']['sales_page_page_id'] = array( 'description' => __( 'The WordPress page ID of the sales page. Required when `sales_page_type` equals `page`. Only returned when the `sales_page_type` equals `page`.', 'lifterlms' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'absint', ), ); $schema['properties']['sales_page_type'] = array( 'description' => __( 'Defines alternate content displayed to visitors and non-enrolled students when accessing the post. - `none` displays the post content. - `content` displays alternate content from the `excerpt` property. - `page` redirects to the WordPress page defined in `content_page_id`. - `url` redirects to the URL defined in `content_page_url`.', 'lifterlms' ), 'type' => 'string', 'default' => 'none', 'enum' => array_keys( llms_get_sales_page_types() ), 'context' => array( 'view', 'edit' ), ); $schema['properties']['sales_page_url'] = array( 'description' => __( 'The URL of the sales page content. Required when `sales_page_type` equals `url`. Only returned when the `sales_page_type` equals `url`.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'format' => 'uri', 'arg_options' => array( 'sanitize_callback' => 'esc_url_raw', ), ); $schema['properties']['tags'] = array( 'description' => __( 'List of membership tags.', 'lifterlms' ), 'type' => 'array', 'items' => array(
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.9 | Introduced. |