function AjaxFormTrait::getAjaxAttributes

Same name in other branches
  1. 4.0.x src/Form/AjaxFormTrait.php \Drupal\ctools\Form\AjaxFormTrait::getAjaxAttributes()

Gets attributes for use with an AJAX modal.

Return value

array The array of attributes.

1 call to AjaxFormTrait::getAjaxAttributes()
AjaxFormTrait::getAjaxButtonAttributes in src/Form/AjaxFormTrait.php
Gets attributes for use with an add button AJAX modal.

File

src/Form/AjaxFormTrait.php, line 19

Class

AjaxFormTrait
Provides helper methods for using an AJAX modal.

Namespace

Drupal\ctools\Form

Code

public static function getAjaxAttributes() {
    return [
        'class' => [
            'use-ajax',
        ],
        'data-dialog-type' => 'modal',
        'data-dialog-options' => Json::encode([
            'width' => 'auto',
        ]),
    ];
}