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

Feature/block editor allow blocks to be excluded #2409

Merged

Conversation

pauldwight
Copy link
Contributor

Description

Currently the BlockEditor either includes all available blocks (default) or you can pass in an array of blocks you want to include.

BlockEditor::make()

 
BlockEditor::make()

    ->blocks(['title', 'quote', 'text'])

We recently had a case where we had a large number of blocks but for a few modules we didn't want to include all of the blocks but instead we need to include all except 1 or 2 blocks.

Rather than using the above to include the blocks we wanted it seemed to make sense to also have to option to include all except ...

This PR allows us to be able to exclude specific blocks from the BlockEditor.

// FormBuilder
BlockEditor::make()->excludeBlocks(['exclude-this-block'])

// Directive
@formField('block_editor', [
    'excludeBlocks' => ['exclude-this-block']
])

// Formview
@php
    $excludeBlocks = [
         'exclude-this-block'
    ];
@endphp

<x-twill::block-editor
    :excludeBlocks="$excludeBlocks"
/>

@ifox ifox merged commit 854b5af into area17:3.x Jan 25, 2024
8 of 10 checks passed
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.

2 participants