acf_field_wysiwyg::render_field_presentation_settings()publicACF 6.0

Renders the field settings used in the "Presentation" tab.

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

Хуков нет.

Возвращает

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

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

$acf_field_wysiwyg = new acf_field_wysiwyg();
$acf_field_wysiwyg->render_field_presentation_settings( $field );
$field(массив) (обязательный)
The field settings array.

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

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

Код acf_field_wysiwyg::render_field_presentation_settings() ACF 6.0.4

function render_field_presentation_settings( $field ) {
	$toolbars = $this->get_toolbars();
	$choices  = array();

	if ( ! empty( $toolbars ) ) {

		foreach ( $toolbars as $k => $v ) {

			$label = $k;
			$name  = sanitize_title( $label );
			$name  = str_replace( '-', '_', $name );

			$choices[ $name ] = $label;
		}
	}

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Tabs', 'acf' ),
			'instructions' => '',
			'type'         => 'select',
			'name'         => 'tabs',
			'choices'      => array(
				'all'    => __( 'Visual & Text', 'acf' ),
				'visual' => __( 'Visual Only', 'acf' ),
				'text'   => __( 'Text Only', 'acf' ),
			),
		)
	);

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Toolbar', 'acf' ),
			'instructions' => '',
			'type'         => 'select',
			'name'         => 'toolbar',
			'choices'      => $choices,
			'conditions'   => array(
				'field'    => 'tabs',
				'operator' => '!=',
				'value'    => 'text',
			),
		)
	);

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Show Media Upload Buttons?', 'acf' ),
			'instructions' => '',
			'name'         => 'media_upload',
			'type'         => 'true_false',
			'ui'           => 1,
		)
	);

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Delay initialization?', 'acf' ),
			'instructions' => __( 'TinyMCE will not be initialized until field is clicked', 'acf' ),
			'name'         => 'delay',
			'type'         => 'true_false',
			'ui'           => 1,
			'conditions'   => array(
				'field'    => 'tabs',
				'operator' => '!=',
				'value'    => 'text',
			),
		)
	);
}