acf_field_oembed::render_field()publicACF 3.6

Create the HTML interface for your field

{} Это метод класса: acf_field_oembed{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$acf_field_oembed = new acf_field_oembed();
$acf_field_oembed->render_field( $field );
$field (обязательный)
-

Список изменений

С версии 3.6 Введена.

Код acf_field_oembed::render_field() ACF 5.10.2

<?php
function render_field( $field ) {

	// atts
	$atts = array(
		'class' => 'acf-oembed',
	);

	// <strong><?php _e("Error.", 'acf'); </strong> _e("No embed found for the given URL.", 'acf');

	// value
	if ( $field['value'] ) {
		$atts['class'] .= ' has-value';
	}

	?>
<div <?php acf_esc_attr_e( $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'] );
	}
	?>
</div>
<i class="acf-icon -picture hide-if-value"></i>
	</div>
	
</div>
	<?php

}