AjaxBasePageNegotiator

Defines a theme negotiator that deals with the active theme on ajax requests.

Many different pages can invoke an Ajax request to a generic Ajax path. It is almost always desired for an Ajax response to be rendered using the same theme as the base page, because most themes are built with the assumption that they control the entire page, so if the CSS for two themes are both loaded for a given page, they may conflict with each other. For example, Bartik is Drupal's default theme, and Seven is Drupal's default administration theme. Depending on whether the "Use the administration theme when editing or creating content" checkbox is checked, the node edit form may be displayed in either theme, but the Ajax response to the Field module's "Add another item" button should be rendered using the same theme as the rest of the page.

Hierarchy

File

core/lib/Drupal/Core/Theme/AjaxBasePageNegotiator.php, line 25

Namespace

Drupal\Core\Theme

Members

Name Modifiers Type Description
AjaxBasePageNegotiator::$configFactory protected property The config factory.
AjaxBasePageNegotiator::$csrfGenerator protected property The CSRF token generator.
AjaxBasePageNegotiator::$requestStack protected property The request stack.
AjaxBasePageNegotiator::applies public function Whether this theme negotiator should be used to set the theme. Overrides ThemeNegotiatorInterface::applies
AjaxBasePageNegotiator::determineActiveTheme public function Determine the active theme for the request. Overrides ThemeNegotiatorInterface::determineActiveTheme
AjaxBasePageNegotiator::__construct public function Constructs a new AjaxBasePageNegotiator.
doc_Drupal
2016-10-29 08:44:00
Comments
Leave a Comment

Please login to continue.