BP_REST_XProfile_Fields_Endpoint: get_item_schema ()

获取符合JSON模式的XProfile字段模式。

描述

返回

(数组)

文件:bp-xprofile /类/ class-bp-rest-xprofile-fields-endpoint.php

public function get_item_schema() {$schema = array('$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'bp_xprofile_field', 'type' => 'object', 'properties' => array('id' => array('context' => array('embed', 'view', 'edit'), 'description' => __('配置文件字段的唯一数字id');', 'buddyboss'), 'readonly' => true, 'type' => 'integer',), 'group_id' => array('context' => array('embed', 'view', 'edit'), 'description' => __('该字段属于组的ID。', 'buddyboss'), 'type' => 'integer',), 'parent_id' => array('context' => array('embed', 'view', 'edit'), 'description' => __('父字段的ID。', 'buddyboss'), 'type' => 'integer',), 'type' => array('context' => array('embed', 'view', 'edit'), 'description' => __('配置文件字段的类型。', 'buddyboss'), 'type' => 'string', 'enum' => buddypress()->profile->field_types, 'arg_options' => array('sanitize_callback' => 'sanitize_key',),), 'name' => array('context' => array('embed', 'view', 'edit'), 'description' => __(' profile字段的名称。', 'buddyboss'), 'type' => 'string', 'arg_options' => array('sanitize_callback' => 'sanitize_text_field',),), 'alternate_name' => array('context' => array('embed', 'view', 'edit'), 'description' => __('配置文件字段的替代名称。', 'buddyboss'), 'type' => 'string', 'default' => ', 'arg_options' => array('sanitize_callback' => 'sanitize_text_field',),), 'description' => array('context' => array('embed', 'view', 'edit'), 'description' => __(' profile字段的描述。', 'buddyboss'), 'type' => 'object', 'arg_options' => array('sanitize_callback' => null, //注意:sanitization实现于self::prepare_item_for_database()。'validate_callback' => null, //注意:验证在self::prepare_item_for_database()中实现。),'properties' => array( 'raw' => array( 'description' => __( 'Content for the profile field, as it exists in the database.', 'buddyboss' ), 'type' => 'string', 'context' => array( 'edit' ), ), 'rendered' => array( 'description' => __( 'HTML content for the profile field, transformed for display.', 'buddyboss' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), ), ), 'is_required' => array( 'context' => array( 'embed', 'view', 'edit' ), 'description' => __( 'Whether the profile field must have a value.', 'buddyboss' ), 'type' => 'boolean', ), 'can_delete' => array( 'context' => array( 'embed', 'view', 'edit' ), 'description' => __( 'Whether the profile field can be deleted or not.', 'buddyboss' ), 'default' => true, 'type' => 'boolean', ), 'field_order' => array( 'context' => array( 'embed', 'view', 'edit' ), 'description' => __( 'The order of the profile field into the group of fields.', 'buddyboss' ), 'type' => 'integer', ), 'option_order' => array( 'context' => array( 'embed', 'view', 'edit' ), 'description' => __( 'The order of the option into the profile field list of options', 'buddyboss' ), 'type' => 'integer', ), 'order_by' => array( 'context' => array( 'embed', 'view', 'edit' ), 'description' => __( 'The way profile field\'s options are ordered.', 'buddyboss' ), 'default' => 'asc', 'type' => 'string', 'enum' => array( 'asc', 'desc' ), ), 'is_default_option' => array( 'context' => array( 'embed', 'view', 'edit' ), 'description' => __( 'Whether the option is the default one for the profile field.', 'buddyboss' ), 'type' => 'boolean', ), 'visibility_level' => array( 'context' => array( 'embed', 'view', 'edit' ), 'description' => __( 'Who may see the saved value for this profile field.', 'buddyboss' ), 'default' => 'public', 'type' => 'string', 'enum' => array_keys( bp_xprofile_get_visibility_levels() ), ), 'options' => array( 'context' => array( 'embed', 'view', 'edit' ), 'description' => __( 'Options of the profile field.', 'buddyboss' ), 'type' => 'array', 'readonly' => true, ), 'data' => array( 'context' => array( 'embed', 'view', 'edit' ), 'description' => __( 'The saved value for this profile field.', 'buddyboss' ), 'type' => 'object', 'readonly' => true, 'properties' => array( 'raw' => array( 'description' => __( 'Value for the field, as it exists in the database.', 'buddyboss' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), ), 'unserialized' => array( 'description' => __( 'Unserialized value for the field, regular string will be casted as array.', 'buddyboss' ), 'type' => 'array', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), 'rendered' => array( 'description' => __( 'HTML value for the field, transformed for display.', 'buddyboss' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), ), ), ), ); /** * Filters the xprofile field schema. * * @param array $schema The endpoint schema. */ return apply_filters( 'bp_rest_xprofile_field_schema', $this->add_additional_fields_schema( $schema ) ); }

更新日志

更新日志
版本 描述
0.1.0 介绍了。

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队