You are here

class YamlFormDialogHelper in YAML Form 8

Helper class for dialog methods.

Hierarchy

Expanded class hierarchy of YamlFormDialogHelper

11 files declare their use of YamlFormDialogHelper
yamlform.theme.inc in includes/yamlform.theme.inc
Preprocessors and helper functions to make theming easier.
YamlFormEntityHandlersForm.php in src/YamlFormEntityHandlersForm.php
YamlFormEntityListBuilder.php in src/YamlFormEntityListBuilder.php
YamlFormPluginHandlerController.php in src/Controller/YamlFormPluginHandlerController.php
YamlFormSubmissionListBuilder.php in src/YamlFormSubmissionListBuilder.php

... See full list

File

src/Utility/YamlFormDialogHelper.php, line 10

Namespace

Drupal\yamlform\Utility
View source
class YamlFormDialogHelper {

  /**
   * Get modal dialog attributes.
   *
   * @param int $width
   *   Width of the modal dialog.
   * @param array $class
   *   Additional class names to be included in the dialog's attributes.
   *
   * @return array
   *   Modal dialog attributes.
   */
  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,
        ]),
      ];
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
YamlFormDialogHelper::getModalDialogAttributes public static function Get modal dialog attributes.