Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Allow Bard's default buttons to be configured #10062

Conversation

ryanmitchell
Copy link
Contributor

@ryanmitchell ryanmitchell commented May 14, 2024

We find anytime we are using Bard fields the default buttons are not what we would want selected, for example we always remove image and table, and rarely use block quote. So you end up deselecting them on every site.

It would be useful to be able to select the defaults so we don't have to do this. It's a 30 second time saver, but it's just one less thing to think about.

I considered using a config for this but theres no existing bard config so it felt like overkill for one setting. Instead I've defined the default buttons as a static property on the bard field type, so you can overwrite them as follows:

// only allow h2 and h3
\Statamic\Fieldtypes\Bard::setDefaultButtons(['h2', 'h3']);

Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one. Can you make a setDefaultButtons method and make $defaultButtons private?

@ryanmitchell
Copy link
Contributor Author

@jasonvarga yep, thats done.

@jasonvarga jasonvarga merged commit 8dff1ff into statamic:5.x May 14, 2024
17 checks passed
@ryanmitchell ryanmitchell deleted the feature/allow-bard-default-buttons-to-be-changed branch May 14, 2024 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants