WP_Widget_Media::form
Outputs the settings update form.
Note that the widget UI itself is rendered with JavaScript via MediaWidgetControl#render().
Метод класса: WP_Widget_Media{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WP_Widget_Media = new WP_Widget_Media(); $WP_Widget_Media->form( $instance );
- $instance(массив) (обязательный)
- Current settings.
Заметки
- Смотрите: [WP_Widget_Media::render_control_template_scripts()](/function/WP_Widget_Media::render_control_template_scripts) Where the JS template is located.
Список изменений
| С версии 4.8.0 | Введена. |
Код WP_Widget_Media::form() WP Widget Media::form WP 6.8.3
<?php
final public function form( $instance ) {
$instance_schema = $this->get_instance_schema();
$instance = wp_array_slice_assoc(
wp_parse_args( (array) $instance, wp_list_pluck( $instance_schema, 'default' ) ),
array_keys( $instance_schema )
);
foreach ( $instance as $name => $value ) : ?>
<input
type="hidden"
data-property="<?php echo esc_attr( $name ); ?>"
class="media-widget-instance-property"
name="<?php echo esc_attr( $this->get_field_name( $name ) ); ?>"
id="<?php echo esc_attr( $this->get_field_id( $name ) ); // Needed specifically by wpWidgets.appendTitle(). ?>"
value="<?php echo esc_attr( is_array( $value ) ? implode( ',', $value ) : (string) $value ); ?>"
/>
<?php
endforeach;
}