You are here

public static function YamlFormDialogHelper::getModalDialogAttributes in YAML Form 8

Get modal dialog attributes.

Parameters

int $width: Width of the modal dialog.

array $class: Additional class names to be included in the dialog's attributes.

Return value

array Modal dialog attributes.

13 calls to YamlFormDialogHelper::getModalDialogAttributes()
template_preprocess_yamlform_help in includes/yamlform.theme.inc
Prepares variables for yamlform help.
YamlFormEntityHandlersForm::form in src/YamlFormEntityHandlersForm.php
Gets the actual form array to be built.
YamlFormEntityListBuilder::getDefaultOperations in src/YamlFormEntityListBuilder.php
Gets this list's default operations.
YamlFormEntityListBuilder::render in src/YamlFormEntityListBuilder.php
Builds the entity listing as renderable array for table.html.twig.
YamlFormPluginHandlerController::listHandlers in src/Controller/YamlFormPluginHandlerController.php
Shows a list of form handlers that can be added to a form.

... See full list

File

src/Utility/YamlFormDialogHelper.php, line 23

Class

YamlFormDialogHelper
Helper class for dialog methods.

Namespace

Drupal\yamlform\Utility

Code

public static function getModalDialogAttributes($width = 800, array $class = []) {
  if (\Drupal::config('yamlform.settings')
    ->get('ui.dialog_disabled')) {
    return $class ? [
      'class' => $class,
    ] : [];
  }
  else {
    $class[] = 'use-ajax';
    return [
      'class' => $class,
      'data-dialog-type' => 'modal',
      'data-dialog-options' => Json::encode([
        'width' => $width,
      ]),
    ];
  }
}