Skip to content

Nesting Components #36

Answered by Z3d0X
cmdobueno asked this question in Q&A
Feb 2, 2023 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

Here is a simple implementation of a grid block, with a toggle for full_width

class GridBlock extends PageBlock
{
    public static function getBlockSchema(): Block
    {
        return Block::make('grid')
            ->schema([
                Toggle::make('full_width')
                    ->label('Full width')
                    ->default(false),

                TextInput::make('columns')
                    ->label('Columns')
                    ->integer()
                    ->required(),

                PageBuilder::make('blocks')
                    ->blocks([
                        MyBlock::getBlockSchema(),
                    ]),
            ]);
    }
}
@props([
    'blocks' =>

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Z3d0X
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mybouhssina
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants