function FormHooks::isModalOrOffcanvas

Same name and namespace in other branches
  1. 11.x core/themes/admin/src/Hook/FormHooks.php \Drupal\admin\Hook\FormHooks::isModalOrOffcanvas()

Check the context we're in.

Checks if the form is in either a modal or an off-canvas dialog.

File

core/themes/admin/src/Hook/FormHooks.php, line 805

Class

FormHooks
Provides form related hook implementations.

Namespace

Drupal\admin\Hook

Code

private function isModalOrOffcanvas() : bool {
  $wrapper_format = $this->getRequestWrapperFormat() ?? '';
  return str_contains($wrapper_format, 'drupal_modal') || str_contains($wrapper_format, 'drupal_dialog');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.