I have created a Page view and this has added the class contextual-links-region to the page $classes variable and this is not the region where the hover links should be shown. I've found views_preprocess_html() that is already killing this the CSS class contextual-links-region attached to the body element, but the kill in the page element is missing.

Patch attached also removes the contextual-links-region class from the 'page' classes that comes directly after the body element and currently enables *all* contextual links in the page; if you hover anywhere over the page.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hass’s picture

Status: Active » Needs review
hass’s picture

Status: Needs review » Active

Buggy QA system

hass’s picture

Status: Active » Needs review

Shoot again into an empty testing queue.

dawehner’s picture

Status: Needs review » Needs work
+++ b/views.moduleundefined
@@ -517,6 +517,30 @@
+* Implements MODULE_preprocess_HOOK().

it would be a bit better if this comment would be "implements hook_preprocess_page".

+++ b/views.moduleundefined
@@ -517,6 +517,30 @@
+    $key = array_search('contextual-links-region', $variables['classes_array']);
+    if ($key !== FALSE) {
+      unset($variables['classes_array'][$key]);

For this you could use array_diff($variables['classes_array'], array('contextual-links-region');

hass’s picture

Status: Needs review » Needs work

It's 100% the same code like views_preprocess_html()... I think it makes no sense to use different logics as this may lead to unexpected failures. Otherwise we should change both functions.

hass’s picture

Status: Needs work » Needs review
tim.plunkett’s picture

Actually, it should be Implements hook_preprocess_HOOK() for page.tpl.php.

#1443202-14: Apply documentation standards for hook_preprocess_HOOK()

dawehner’s picture

Okay let's fix both places.

hass’s picture

Status: Needs work » Needs review
FileSize
2.55 KB

New patch attached hopefully fits.

sun’s picture

Given the consequences of this bug outlined in the OP, this doesn't necessarily sound like a duplicate of #1170428: Contextual page links behavior causes gap above admin_menu on Seven theme.

However, since this patch attempts to remove the .contextual-links-region class from the BODY, and at the same time, refers to the JavaScript for re-injecting it, and that exact JavaScript is the cause for other bugs (as detailed in aforementioned issue), it would be good to double-check that the proposed fix here does not conflict with the necessary fix over there.

hass’s picture

Version: 7.x-3.3 » 7.x-3.x-dev

@sun: views 3.3 does not add the contextual links to body... Your JS addition is a bug that must be a leftover of one older bug. Above patch is partly just refactoring - at least in regards to body element.

hass’s picture

Re-attaching #9 to get the green light because of wrong version selected in past.

hass’s picture

@dawehner: Any chance for a commit?

dawehner’s picture

Status: Needs review » Needs work
+++ b/views.moduleundefined
@@ -516,7 +516,7 @@
+      $variables['classes_array'] = array_diff($variables['classes_array'], array('contextual-links-region'));

What is the need to do that via array_diff, the previous code was much simpler.

+++ b/views.moduleundefined
@@ -525,6 +525,27 @@
+  // page.tpl.php, so we can only find it using JavaScript. We therefore remove
+  // the "contextual-links-region" class from the <body> tag here and add

Mh i'm wondering where this javascript exists at the moment.

hass’s picture

Status: Needs work » Needs review

I changed this only for You to array_diff. See your comment #4, please or use my patch in #1.

hass’s picture

@dawehner: What is holding this patch still back?

andyhu’s picture

tested working, hope this patch will be committed soon

agalitsyn’s picture

This patch didn't help me.
Because in views-contextual.js class contextual-links-region added to body.

.contextual-links-region {
outline: none;
position: relative;
}

Position relative gives wrong intend to admin menu.
Fix see in attached patch

Status: Needs review » Needs work

The last submitted patch, views-7.x-3.5 -fix-admin-menu-indend-1493210-18.patch, failed testing.

darrenmothersele’s picture

Just fixing the formatting of patch in #18 so that it applies correctly.

Dmitriy.trt’s picture

Status: Needs work » Needs review
knretaleato’s picture

Status: Needs review » Needs work

This fixed the problem for me, hope it will be committed!

knretaleato’s picture

Status: Needs work » Needs review

Oops, accidentally changed to needs work. :)

hass’s picture

Status: Needs review » Reviewed & tested by the community

Per feedback from several people.

scotwith1t’s picture

would love to see this one committed too. simple enough to get around as i don't want to have to keep patching views, so i just wrote 1 line of jquery to remove it in my theme.

scotwith1t’s picture

Issue summary: View changes

Updated issue summary.

lnicks’s picture

donquixote’s picture

Issue summary: View changes

#14 / #15

-      unset($variables['classes_array'][$key]);
+      $variables['classes_array'] = array_diff($variables['classes_array'], array('contextual-links-region'));

I agree, this looks weird.
@dawehner Any reason you asked for array_diff() in #4?

BBC’s picture

#20 worked for me

dawehner’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 7.x-3.x-dev » 8.0.x-dev
Component: User interface » views.module
Status: Reviewed & tested by the community » Patch (to be ported)
Issue tags: +VDC

I agree, this looks weird.
@dawehner Any reason you asked for array_diff() in #4?

I thought that this could replace the array_search before as well, but well, in reality it is not possible.

Let's get this in and solve it also properly in core.

Committed and pushed

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

catch’s picture

Status: Patch (to be ported) » Needs work

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Lendude’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 8.9.x-dev » 8.x-3.x-dev
Component: views.module » Code
Status: Needs work » Fixed
Issue tags: +Bug Smash Initiative

Cleaning up old bugs.

As far as I can tell this has been completely refactored in D8/D9 so moving back to D7 Views and marking fixed per #29.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.