Links

Modal

This block type renders a modal window with inner blocks.

Parameters

  • title - the modal window title;
  • model - an optional model name to make the window ID unique;
  • all the parameters from the Container block type.

Example

The code below renders a modal window with the "My Custom Text" title and a single inner block of the content type that outputs the "Hello World!" text. If you add a link with the #my_custom_modal URL anywhere on a page, it will open this modal window on click.
echo ( new HivePress\Blocks\Modal(
[
'title' => 'My Custom Text',
'name' => 'my_custom_modal',
'blocks' => [
'my_custom_block' => [
'type' => 'content',
'content' => 'Hello World!',
'_order' => 123,
],
],
]
) )->render();
Last modified 4mo ago