core/includes/theme.inc | 13 +++++++++---- core/modules/edit/js/editors/formEditor.js | 2 +- core/modules/edit/js/views/AppView.js | 2 +- .../LanguageNegotiation/LanguageNegotiationSession.php | 1 - .../Plugin/LanguageNegotiation/LanguageNegotiationUrl.php | 1 - .../lib/Drupal/system/Tests/Theme/FunctionsTest.php | 6 +++--- core/modules/toolbar/js/escapeAdmin.js | 2 +- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 335fd58..5343cce 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1192,14 +1192,15 @@ function template_preprocess_status_messages(&$variables) { * route_name + route_parameters or href (path), language and query options * to the current URL for each of the links, to determine whether the link * is "active". If so, an "active" class will be applied to the list item - * containing the link. It is important to use this sparingly since it is - * usually unnecessary and requires extra processing. + * containing the link, as well as the link itself. It is important to use + * this sparingly since it is usually unnecessary and requires extra + * processing. * For anonymous users, the "active" class will be calculated on the server, * because most sites serve each anonymous user the same cached page anyway. * For authenticated users, the "active" class will be calculated on the * client (through JavaScript), only data- attributes are added to list - * items to prevent breaking the render cache. The JavaScript is added in - * system_page_build(). + * items and contained links, to prevent breaking the render cache. The + * JavaScript is added in system_page_build(). * - heading: (optional) A heading to precede the links. May be an * associative array or a string. If it's an array, it can have the * following elements: @@ -1285,6 +1286,10 @@ function theme_links($variables) { // only if the 'set_active_class' option is not empty. if (isset($link['href']) || isset($link['route_name'])) { if (!empty($variables['set_active_class'])) { + + // Also enable set_active_class for the contained link. + $link_element['#options']['set_active_class'] = TRUE; + if (!empty($link['language'])) { $li_attributes['hreflang'] = $link['language']->id; } diff --git a/core/modules/edit/js/editors/formEditor.js b/core/modules/edit/js/editors/formEditor.js index 7eda4e1..9687f58 100644 --- a/core/modules/edit/js/editors/formEditor.js +++ b/core/modules/edit/js/editors/formEditor.js @@ -144,7 +144,7 @@ Drupal.edit.editors.form = Drupal.edit.EditorView.extend({ delete this.formSaveAjax; // Allow form widgets to detach properly. - Drupal.detachBehaviors(this.$formContainer, null, 'unload'); + Drupal.detachBehaviors(this.$formContainer.get(0), null, 'unload'); this.$formContainer .off('change.edit', ':input') .off('keypress.edit', 'input') diff --git a/core/modules/edit/js/views/AppView.js b/core/modules/edit/js/views/AppView.js index ba65c3e..599ba2b 100644 --- a/core/modules/edit/js/views/AppView.js +++ b/core/modules/edit/js/views/AppView.js @@ -448,7 +448,7 @@ Drupal.edit.AppView = Backbone.View.extend({ // Attach behaviors again to the modified piece of HTML; this will // create a new field model and call rerenderedFieldToCandidate() with // it. - Drupal.attachBehaviors($context); + Drupal.attachBehaviors($context.get(0)); }; // When propagating the changes of another instance of this field, this diff --git a/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php index afed9c2..e56278d 100644 --- a/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php +++ b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php @@ -138,7 +138,6 @@ function getLanguageSwitchLinks(Request $request, $type, $path) { 'title' => $language->name, 'attributes' => array('class' => array('language-link')), 'query' => $query, - 'set_active_class' => TRUE, ); if ($language_query != $langcode) { $links[$langcode]['query'][$param] = $langcode; diff --git a/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php index abcf4b5..a72ca44 100644 --- a/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php +++ b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php @@ -194,7 +194,6 @@ function getLanguageSwitchLinks(Request $request, $type, $path) { 'title' => $language->name, 'language' => $language, 'attributes' => array('class' => array('language-link')), - 'set_active_class' => TRUE, ); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php index f8ec146..0ae413f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php @@ -232,10 +232,10 @@ function testLinks() { $variables['set_active_class'] = TRUE; $expected_links = ''; $expected_links .= ''; $expected = $expected_heading . $expected_links; $this->assertThemeOutput('links', $variables, $expected); diff --git a/core/modules/toolbar/js/escapeAdmin.js b/core/modules/toolbar/js/escapeAdmin.js index a602766..72a9fb8 100644 --- a/core/modules/toolbar/js/escapeAdmin.js +++ b/core/modules/toolbar/js/escapeAdmin.js @@ -7,7 +7,7 @@ "use strict"; -var pathInfo = drupalSettings; +var pathInfo = drupalSettings.path; var escapeAdminPath = sessionStorage.getItem('escapeAdminPath'); // Saves the last non-administrative page in the browser to be able to link back