public static function ContentSyncDialogHelper::getModalDialogAttributes in Content Synchronization 3.0.x
Same name and namespace in other branches
- 8.2 src/Utility/ContentSyncDialogHelper.php \Drupal\content_sync\Utility\ContentSyncDialogHelper::getModalDialogAttributes()
- 8 src/Utility/ContentSyncDialogHelper.php \Drupal\content_sync\Utility\ContentSyncDialogHelper::getModalDialogAttributes()
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.
File
- src/
Utility/ ContentSyncDialogHelper.php, line 82
Class
- ContentSyncDialogHelper
- Helper class for dialog methods.
Namespace
Drupal\content_sync\UtilityCode
public static function getModalDialogAttributes($width = 800, array $class = []) {
if (\Drupal::config('content_sync.settings')
->get('ui.dialog_disabled')) {
return $class ? [
'class' => $class,
] : [];
}
else {
$class[] = 'use-ajax';
if (self::useOffCanvas()) {
return [
'class' => $class,
'data-dialog-type' => 'dialog',
'data-dialog-renderer' => self::getOffCanvasTriggerName(),
'data-dialog-options' => Json::encode([
'width' => $width > 480 ? 480 : $width,
]),
];
}
else {
return [
'class' => $class,
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => $width,
]),
];
}
}
}