Comments

Bojhan’s picture

StatusFileSize
new1.32 KB
  if (path_is_admin(current_path()) && (!module_exists('dashboard') || !dashboard_is_visible())) {
    return;
  }

So using path_is_admin I determain if its on admin/* and disable contextual links. Excluding Dashboard which applies the contextual links pattern to its module's interface. With that in mind, perhaps this should be more flexible to allow other modules to do such a thing?

Bojhan’s picture

Status: Active » Needs review

Mr.bot

dave reid’s picture

Yeah I'm thinking there should be a way for a module to be able to disable form its own code, and dashboard would be an implementation of this. Something like:

/**
 * Implements hook_menu_contextual_links_alter().
 */
function dashboard_menu_contextual_links_alter(&$links, $router_item, $root_path) {
  if (path_is_admin(current_path()) && !dashboard_is_visible()) {
    $links = array();
  }
}

But this still isn't good since we still have to do a check in the contextual.module for path_is_admin().

:/

chx’s picture

Bojhan’s picture

Issue tags: -Needs screenshots
StatusFileSize
new14.45 KB
new13.01 KB

Couldn't screenshot my mouse, so painted one in.

Before patch

contextualinks_before.png

After patch

contextualinks_after.png

dave reid’s picture

Little more context.

Bojhan’s picture

Title: Remove contextual links from admin/* » Remove contextual links from help text block

chx pointed out this is a wrong approach, we have to remove it only from the help text block. Obviously I was wrong, correcting the title.

dave reid’s picture

StatusFileSize
new740 bytes

This is what we want then, disabling contextual links on the system_help block.

dave reid’s picture

It's only possible to do this here and not in hook_block_view_alter() contrary to the example there since the contextual links are not available yet in the $data array. Let me know if there is any better place or what could be improved since I don't see any better solution than #8 right now.

sun’s picture

Why shouldn't I be able to configure the help block contextually?

I also think that a limitation to != admin* is wrong.

What do we really want?

Bojhan’s picture

We want to hide contextual links on help block - as the patch outlines.

Why? Because the use case of configuring help text blocks is very very slim, and shouldn't have contextual links - and it draws attention unnecessarily.

Bojhan’s picture

After discussing with tha_sun in IRC, he referd that the ideal solution would be "that "stack" of contextual links would support an #access property or similar" but that related to an issue "dynamic argument loading" - which to me seems somewhat heavy to make a counter part of this issue.

Given that we should either go with #8 or go for a CSS approach. Would love commiters feedback on this.

sun’s picture

+++ modules/block/block.module	19 Dec 2009 21:25:46 -0000
@@ -280,7 +280,7 @@ function _block_get_renderable_array($li
     // Add contextual links for this block; skipping the system main block.
-    if ($key != 'system_main') {
+    if ($key != 'system_main' && $key != 'system_help') {

At the very least, we need to update the inline comment if we go with this patch... It's relatively clear why we skip system_main (from a technical perspective), but system_help is a purely "assumptions"-driven exception.

This review is powered by Dreditor.

dries’s picture

I'm OK with this patch because I agree that it is slightly annoying while on the administration pages -- I think it is reasonable to assume that less than 1% of all Drupal users would want to edit this block inline. I can certainly relate to why we are considering this patch. That said, I'd think that most editors wouldn't have the block administration permission. Happy to commit this when marked RTBC though.

Status: Needs review » Needs work
Issue tags: -Usability, -D7UX

The last submitted patch, , failed testing.

Status: Needs work » Needs review
Issue tags: +Usability, +D7UX

Re-test of from comment #2391636 was requested by @user.

mrfelton’s picture

Patch in #8 seems to work for me. Removes the contextual links from the help block.

Re-test of 663956-block-help-nocontextual-D7.patch from comment #8 was requested by aspilicious.

aspilicious’s picture

Gonna retest this for sure, and i'm gonna test this now.
I'll report back in a few minutes!

amc’s picture

sun’s picture

Status: Needs review » Needs work

Still needs work, see #13.

sun’s picture

Priority: Normal » Major
Status: Needs work » Needs review
StatusFileSize
new2.06 KB

Attached patch looks a bit more Drupalish.

At first, I added the hook implementation to Help module, but then had to realize that System module provides the Help block. (That's odd, should be cleaned up in D8.)

The missing alter hooks for the renderable arrays generated by Block module make this issue much major, at minimum.

sun’s picture

Assigned: Unassigned » sun
Bojhan’s picture

Category: task » bug

Since hooks are also missing, bug?

sun’s picture

Category: bug » task
Priority: Major » Normal
StatusFileSize
new1.1 KB

Block API - what a mess. hook_block_view_alter() + co badly need to be cleaned up. We are currently caching block alterations.

Back to #8 with better docs. Let's move the addition of hook_block_region_alter() to a separate issue.

sun’s picture

Status: Needs review » Reviewed & tested by the community

This is actually the almost same patch that was about to be committed previously already - just the docs have been expanded to explain WTF is happening, like I requested back in #13.

Bojhan’s picture

Awesome :) Do you have an issue for the other thing we can link?

sun’s picture

No, I'm starting to needlessly fight with core committers to get the most simple bug fixes in, and I don't really care about Block API, so I won't even start to think about creating any issues for it. ;)

dries’s picture

Status: Reviewed & tested by the community » Fixed

Make D7, not war. ;-)
Committed to CVS. Thanks.

moshe weitzman’s picture

contextual links recently became a proper part of the $page array so there are other ways to fix this now. but this way is fine too.

Status: Fixed » Closed (fixed)
Issue tags: -Usability, -D7UX

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