acf_field_wysiwyg::get_toolbars()publicACF 5.0.0

get_toolbars

This function will return an array of toolbars for the WYSIWYG field

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

Возвращает

(Массив).

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

$acf_field_wysiwyg = new acf_field_wysiwyg();
$acf_field_wysiwyg->get_toolbars();

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

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

Код acf_field_wysiwyg::get_toolbars() ACF 6.0.4

function get_toolbars() {

	// vars
	$editor_id = 'acf_content';
	$toolbars  = array();

	// mce buttons (Full)
	$mce_buttons   = array( 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' );
	$mce_buttons_2 = array( 'strikethrough', 'hr', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' );

	// mce buttons (Basic)
	$teeny_mce_buttons = array( 'bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'fullscreen' );

	// WP < 4.7
	if ( acf_version_compare( 'wp', '<', '4.7' ) ) {

		$mce_buttons   = array( 'bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' );
		$mce_buttons_2 = array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' );
	}

	// Full
	$toolbars['Full'] = array(
		1 => apply_filters( 'mce_buttons', $mce_buttons, $editor_id ),
		2 => apply_filters( 'mce_buttons_2', $mce_buttons_2, $editor_id ),
		3 => apply_filters( 'mce_buttons_3', array(), $editor_id ),
		4 => apply_filters( 'mce_buttons_4', array(), $editor_id ),
	);

	// Basic
	$toolbars['Basic'] = array(
		1 => apply_filters( 'teeny_mce_buttons', $teeny_mce_buttons, $editor_id ),
	);

	// Filter for 3rd party
	$toolbars = apply_filters( 'acf/fields/wysiwyg/toolbars', $toolbars );

	// return
	return $toolbars;

}