CustomBlocks

CustomBlocks implements OutputableInterface

Custom Blocks

Methods

__construct

Create a Blocks input with a given template.

CustomBlocks::__construct( \Gibbon\Forms\FormFactoryInterface &$factory, string $name, \Gibbon\Forms\Input\Session $session )

fromTemplate

Set a predefined layout using OutputableInterface which will be cloned for each new block.

CustomBlocks::fromTemplate( \Gibbon\Forms\OutputableInterface $block ): void

TODO: add fromAjax option for loading in templates dynamically?


placeholder

Changes the placeholder string when no blocks are present.

CustomBlocks::placeholder( string $value ): self

Returns Self: This method can be chained.


settings

Updates the settings array which is passed as json params to JS.

CustomBlocks::settings( string $value ): self

Returns Self: This method can be chained.


addToolInput

Adds the given input into the tool bar at the bottom.

CustomBlocks::addToolInput( \Gibbon\Forms\OutputableInterface $input ): self

Returns Self: This method can be chained.


addBlockButton

Adds the given button to the sidebar of each block.

CustomBlocks::addBlockButton( string $name, string $title, string $icon, $class = '' ): self

Note: The name of the button is triggered as an event on the Block element when clicked, as function(event, block, button)

Returns Self: This method can be chained.


addBlock

Adds a block from an array of data.

CustomBlocks::addBlock( string $id, array $data = array() ): self

Returns Self: This method can be chained.


addPredefinedBlock

Add a set of data that a new block can be created from via an identifier + add block trigger.

CustomBlocks::addPredefinedBlock( string $id, array $data = array() ): self

Returns Self: This method can be chained.


getOutput

Gets the HTML output for this form element.

CustomBlocks::getOutput( ): string

Return Value: string