trait AjaxFormTrait in Context 8
Same name and namespace in other branches
- 8.4 src/Form/AjaxFormTrait.php \Drupal\context\Form\AjaxFormTrait
- 8.0 src/Form/AjaxFormTrait.php \Drupal\context\Form\AjaxFormTrait
Provides helper methods for using an AJAX modal. This is a copy of the ctools AjaxFormTrait.
Hierarchy
- trait \Drupal\context\Form\AjaxFormTrait
4 files declare their use of AjaxFormTrait
- BlockFormBase.php in src/
Reaction/ Blocks/ Form/ BlockFormBase.php - Blocks.php in src/
Plugin/ ContextReaction/ Blocks.php - ContextEditForm.php in modules/
context_ui/ src/ Form/ ContextEditForm.php - ContextListBuilder.php in modules/
context_ui/ src/ ContextListBuilder.php
File
- src/
Form/ AjaxFormTrait.php, line 17 - Contains \Drupal\context\Form\AjaxFormTrait.
Namespace
Drupal\context\FormView source
trait AjaxFormTrait {
/**
* Gets attributes for use with an AJAX modal.
*
* @return array
*/
public static function getAjaxAttributes() {
return [
'class' => [
'use-ajax',
],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => 1000,
]),
];
}
/**
* Gets attributes for use with an add button AJAX modal.
*
* @return array
*/
public static function getAjaxButtonAttributes() {
return NestedArray::mergeDeep(AjaxFormTrait::getAjaxAttributes(), [
'class' => [
'button',
'button--small',
'button-action',
],
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AjaxFormTrait:: |
public static | function | Gets attributes for use with an AJAX modal. | |
AjaxFormTrait:: |
public static | function | Gets attributes for use with an add button AJAX modal. |