WP_Widget_Media_Gallery::get_instance_schema()
Get schema for properties of a widget instance (item).
Метод класса: WP_Widget_Media_Gallery{}
Хуки из метода
Возвращает
Массив
. Schema for properties.
Использование
$WP_Widget_Media_Gallery = new WP_Widget_Media_Gallery(); $WP_Widget_Media_Gallery->get_instance_schema();
Заметки
- Смотрите: WP_REST_Controller::get_item_schema()
- Смотрите: WP_REST_Controller::get_additional_fields()
Список изменений
С версии 4.9.0 | Введена. |
Код WP_Widget_Media_Gallery::get_instance_schema() WP Widget Media Gallery::get instance schema WP 6.6.1
public function get_instance_schema() { $schema = array( 'title' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'description' => __( 'Title for the widget' ), 'should_preview_update' => false, ), 'ids' => array( 'type' => 'array', 'items' => array( 'type' => 'integer', ), 'default' => array(), 'sanitize_callback' => 'wp_parse_id_list', ), 'columns' => array( 'type' => 'integer', 'default' => 3, 'minimum' => 1, 'maximum' => 9, ), 'size' => array( 'type' => 'string', 'enum' => array_merge( get_intermediate_image_sizes(), array( 'full', 'custom' ) ), 'default' => 'thumbnail', ), 'link_type' => array( 'type' => 'string', 'enum' => array( 'post', 'file', 'none' ), 'default' => 'post', 'media_prop' => 'link', 'should_preview_update' => false, ), 'orderby_random' => array( 'type' => 'boolean', 'default' => false, 'media_prop' => '_orderbyRandom', 'should_preview_update' => false, ), ); /** This filter is documented in wp-includes/widgets/class-wp-widget-media.php */ $schema = apply_filters( "widget_{$this->id_base}_instance_schema", $schema, $this ); return $schema; }