Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
A toolset for quick start of using forms in modal windows, flavored by access checks.
Usage
The element to open a form in a modal window.
$form['actions']['view_filter_save'] = [
'#type' => 'modal_form_link',
'#class' => ViewFilterSelectForm::class,
'#title' => $this->t('Save filter'),
'#access' => $this->currentUser->isAuthenticated(),
'#printed' => !$this->isFiltersApplied(),
'#attributes' => [
'class' => ['save-filter'],
'data-query-parameters' => Json::encode([
'name' => $view_name,
'display' => $this->view->current_display,
]),
'data-dialog-options' => Json::encode([
'dialogClass' => 'modal--views-save',
'width' => '500px',
]),
],
];
The ViewFilterSelectForm
is a standard form implementation (any class that implements the \Drupal\Core\Form\FormInterface
).
The additional requirement is to implement the \Drupal\modal_form\Form\ModalFormAccessInterface
to define the access checks.
Supporting organizations:
Project information
- Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Developer Tools
- 31 sites report using this module
- Created by BR0kEN on , updated
- Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.