Developer Docs
  • Getting started
  • Tutorials
    • Integrate your theme with HivePress
    • Create a custom HivePress extension
  • Framework
    • Blocks
      • Callback
      • Container
      • Content
      • Form
      • Menu
      • Modal
      • Part
      • Section
      • Template
      • Toggle
    • Components
      • Cache
      • Helper
      • Request
      • Router
      • Translator
    • Configurations
      • Comment types
      • Image sizes
      • Meta boxes
      • Post types
      • Scripts
      • Settings
      • Strings
      • Styles
      • Taxonomies
    • Controllers
    • Emails
    • Fields
      • Checkbox
      • Checkboxes
      • Date
      • Date Range
      • Email
      • File
      • Number
      • Number Range
      • Password
      • Phone
      • Radio Buttons
      • Repeater
      • Select
      • Text
      • Textarea
      • Time
      • URL
    • Forms
    • Menus
    • Models
      • Making queries
      • Creating models
      • Customizing models
    • Templates
  • Resources
    • Code snippets
    • Code reference
    • Hook reference
    • REST API
Powered by GitBook
On this page
  • Parameters
  • Example

Was this helpful?

  1. Framework
  2. Blocks

Modal

PreviousMenuNextPart

Last updated 2 years ago

Was this helpful?

This block type renders a modal window with inner blocks.

Parameters

  • title - the modal window title;

  • model - an optional name to make the window ID unique;

  • all the parameters from the 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();

model
Container