WYSIWYG Toolbars
The WYSIWYG_Toolbars class lets you define custom TinyMCE toolbar presets that can be used across WYSIWYG fields in your modules and post type fields. This controls which formatting buttons are available to content editors.
Configuration File
Section titled “Configuration File”functions/project/config/wysiwyg-toolbars_config.php
<?phpreturn [ 'basic' => [ 'formatselect', 'bold', 'italic', 'link', 'unlink', 'bullist', 'numlist', 'removeformat', ], 'standard' => [ 'formatselect', 'bold', 'italic', 'underline', 'link', 'unlink', 'bullist', 'numlist', 'blockquote', 'removeformat', 'pastetext', ], 'minimal' => [ 'bold', 'italic', 'link', 'unlink', ],];Using a Custom Toolbar
Section titled “Using a Custom Toolbar”When defining a WYSIWYG field with ACF_Builder, reference the toolbar name:
<?phpACF_Builder::wysiwyg(['name' => 'content', 'toolbar' => 'basic'])ACF_Builder::wysiwyg(['name' => 'rich_content', 'toolbar' => 'standard'])ACF_Builder::wysiwyg(['name' => 'note', 'toolbar' => 'minimal'])Available Toolbar Buttons
Section titled “Available Toolbar Buttons”Common TinyMCE buttons you can include:
| Button | Description |
|---|---|
formatselect | Heading dropdown (H1-H6, Paragraph) |
bold | Bold text |
italic | Italic text |
underline | Underline text |
link | Insert link |
unlink | Remove link |
bullist | Unordered list |
numlist | Ordered list |
blockquote | Blockquote |
removeformat | Remove formatting |
pastetext | Paste as plain text |
alignleft | Align left |
aligncenter | Align center |
hr | Horizontal rule |
charmap | Special characters |
Knowledge Check
Test your understanding of this section
Loading questions...