acf_field_wysiwyg::render_field_settings()publicACF 3.6

Create extra options for your field. This is rendered when editing a field. The value of $field['name'] can be used (like bellow) to save extra data to the $field

@type action

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

Хуков нет.

Возвращает

null. Ничего.

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

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

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

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

Код acf_field_wysiwyg::render_field_settings() ACF 5.10.2

function render_field_settings( $field ) {

	// vars
	$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;
		}
	}

	// default_value
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Default Value', 'acf' ),
			'instructions' => __( 'Appears when creating a new post', 'acf' ),
			'type'         => 'textarea',
			'name'         => 'default_value',
		)
	);

	// tabs
	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' ),
			),
		)
	);

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

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

	// delay
	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',
			),
		)
	);

}