acf_field_oembed::render_field
Renders the oEmbed field.
Метод класса: acf_field_oembed{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$acf_field_oembed = new acf_field_oembed(); $acf_field_oembed->render_field( $field );
- $field(массив) (обязательный)
- The field settings array.
Список изменений
| С версии 3.6 | Введена. |
Код acf_field_oembed::render_field() acf field oembed::render field ACF 6.4.2
<?php
public function render_field( $field ) {
$atts = array(
'class' => 'acf-oembed',
'data-nonce' => wp_create_nonce( 'acf_field_' . $this->name . '_' . $field['key'] ),
);
if ( $field['value'] ) {
$atts['class'] .= ' has-value';
}
?>
<div <?php echo acf_esc_attrs( $atts ); ?>>
<?php
acf_hidden_input(
array(
'class' => 'input-value',
'name' => $field['name'],
'value' => $field['value'],
)
);
?>
<div class="title">
<?php
acf_text_input(
array(
'class' => 'input-search',
'value' => $field['value'],
'placeholder' => __( 'Enter URL', 'acf' ),
'autocomplete' => 'off',
)
);
?>
<div class="acf-actions -hover">
<a data-name="clear-button" href="#" class="acf-icon -cancel grey"></a>
</div>
</div>
<div class="canvas">
<div class="canvas-media">
<?php
if ( $field['value'] ) {
echo $this->wp_oembed_get( $field['value'], $field['width'], $field['height'] ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- wp_ombed_get generates HTML safe output.
}
?>
</div>
<i class="acf-icon -picture hide-if-value"></i>
</div>
</div>
<?php
}