acf_field_url::render_field()publicACF 3.6

Create the HTML interface for your field

Метод класса: acf_field_url{}

Хуков нет.

Возвращает

null. Ничего (null).

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

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

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

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

Код acf_field_url::render_field() ACF 6.0.4

function render_field( $field ) {

	// vars
	$atts  = array();
	$keys  = array( 'type', 'id', 'class', 'name', 'value', 'placeholder', 'pattern' );
	$keys2 = array( 'readonly', 'disabled', 'required' );
	$html  = '';

	// atts (value="123")
	foreach ( $keys as $k ) {
		if ( isset( $field[ $k ] ) ) {
			$atts[ $k ] = $field[ $k ];
		}
	}

	// atts2 (disabled="disabled")
	foreach ( $keys2 as $k ) {
		if ( ! empty( $field[ $k ] ) ) {
			$atts[ $k ] = $k;
		}
	}

	// remove empty atts
	$atts = acf_clean_atts( $atts );

	// render
	$html .= '<div class="acf-input-wrap acf-url">';
	$html .= '<i class="acf-icon -globe -small"></i>' . acf_get_text_input( $atts );
	$html .= '</div>';

	// return
	echo $html;

}