function OpenModalWizardCommand::__construct

Same name and namespace in other branches
  1. 4.0.x src/Ajax/OpenModalWizardCommand.php \Drupal\ctools\Ajax\OpenModalWizardCommand::__construct()

Constructs an OpenModalDialog object.

The modal dialog differs from the normal modal provided by OpenDialogCommand in that a modal prevents other interactions on the page until the modal has been completed. Drupal provides a built-in modal for this purpose, so no selector needs to be provided.

Parameters

string $title: The title of the dialog.

string|array $content: The content that will be placed in the dialog, either a render array or an HTML string.

array $dialog_options: (optional) Settings to be passed to the dialog implementation. Any jQuery UI option can be used. See http://api.jqueryui.com/dialog.

array|null $settings: (optional) Custom settings that will be passed to the Drupal behaviors on the content of the dialog. If left empty, the settings will be populated automatically from the current request.

Overrides OpenModalDialogCommand::__construct

File

src/Ajax/OpenModalWizardCommand.php, line 15

Class

OpenModalWizardCommand

Namespace

Drupal\ctools\Ajax

Code

public function __construct($object, $tempstore_id, array $parameters = [], array $dialog_options = [], $settings = NULL) {
  // Instantiate the wizard class properly.
  $parameters += [
    'tempstore_id' => $tempstore_id,
    'machine_name' => NULL,
    'step' => NULL,
  ];
  $form = \Drupal::service('ctools.wizard.factory')->getWizardForm($object, $parameters, TRUE);
  $title = $form['#title'] ?? '';
  $content = $form;
  parent::__construct($title, $content, $dialog_options, $settings);
}