Rationale:

1. Site administrators might want to turn off contextual links for some themes but not others (for example, a site using Seven as the admin theme might want the contextual links displayed there as nice icons but not have them appear for the main site theme if they are perceived to get in the way of administrators navigating the site).
2. Some theme designers might not want to support displaying contextual links at all (if it is not an element or concept that fits in well with their particular theme).

The patch is very simple and is attached. The only slightly complicated thing is how to display the permission description for "access contextual links" in the case where some theme(s) on the site are not configured to display them...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David_Rothstein’s picture

Category: feature » task

Really more of a followup task for the whole contextual links feature than an actual new feature in and of itself.

#626286: Make contextual links a module is related, in that it might be tricky (although still theoretically possible) to do both...

sun’s picture

Status: Needs review » Postponed

I think this makes sense.

However, I really do not like how this is all squashed into a monster bloat of a system.module. So let's do #626286: Make contextual links a module first, please.

Afterwards, this new contextual_links module will be a nice show-case for what can be achieved with Drupal's sub-systems (render/theme/menu).

David_Rothstein’s picture

Status: Postponed » Needs work

#626286: Make contextual links a module was committed, so this would need a reroll.

dev.cmswebsiteservices’s picture

Assigned: Unassigned » dev.cmswebsiteservices
Status: Needs work » Needs review
FileSize
3.35 KB

Please see the patch, theme settings should now work as per requirements.

Status: Needs review » Needs work

The last submitted patch, contextual-629160-4.patch, failed testing.

dev.cmswebsiteservices’s picture

Status: Needs work » Needs review
FileSize
3.77 KB

Status: Needs review » Needs work

The last submitted patch, contextual-629160-6.patch, failed testing.

dev.cmswebsiteservices’s picture

Status: Needs work » Needs review
FileSize
3.96 KB
Dries’s picture

I'd vote to postpone this to D8.

effulgentsia’s picture

Version: 7.x-dev » 8.x-dev

I agree with #9. We don't make display of toolbar or shortcut bar a theme setting. Why should contextual links be? That said, I hope it's relatively easy for a contrib module and for a contrib theme to be able to turn off display of contextual links through some alter hook and/or preprocess function / theme function. If it's not, please open an issue for that and link to it from here.

sun’s picture

Component: theme system » contextual.module
David_Rothstein’s picture

The difference between this and something like toolbar/shortcuts is that contextual links add themselves to existing items on the page, in a way that can potentially interfere with a theme.

Contextual links are added in a template preprocess function, so it should be possible for a theme to turn them off via that method (although not as straightforward as a normal theme setting would be). However, as described originally, site administrators might want to configure this setting too (e.g. turn contextual links off for the admin theme and on for the main site theme, or vice versa), which was another reason to make this a theme setting.

However, at the moment this probably isn't the most pressing thing to be working on for Drupal 7 :)

-osiris-’s picture

dqd’s picture

The difference between this and something like toolbar/shortcuts is that contextual links add themselves to existing items on the page, in a way that can potentially interfere with a theme.

I think local_task tabs are more interfering with a theme and should be rather considered to be able turning on/off. Contextual links are a common CMS feature, not only in Drupal and the way the are hidden in the first view, is a good solution to prevent cluttering.

That said, I hope it's relatively easy for a contrib module and for a contrib theme to be able to turn off display of contextual links through some alter hook and/or preprocess function / theme function.

^^ A start is made, feel free to help (CLE - Contextual links evereywhere) I don't have a problem with merging this later, if it makes sense and since we have a deadline now for core, I agree with that it makes sense to think about contextual links in contrib. Would love to hear what Dries, catch and contextual module maintainers thinks about that.

Bojhan’s picture

Yup, can this get a reroll - I see no reason why we shouldn't do this. Contextual links are in a different space than toolbar/shortcutbar.

Wim Leers’s picture

Version: 8.x-dev » 9.x-dev
catch’s picture

Version: 9.x-dev » 8.1.x-dev
Issue summary: View changes

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

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now 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.

Wim Leers’s picture

Title: Add a theme setting for contextual links » Allow a theme to opt out from contextual links

Theme settings are a thing that's going away. Instead, we should allow a theme's *.info.yml file to specify a contextual_links: false flag, for example.

David_Rothstein’s picture

Title: Allow a theme to opt out from contextual links » Add a theme setting for contextual links
Category: Task » Feature request

Per #12 there's probably already a way to do that, but it's not what this issue is about. The goal is to allow site administrators to configure it on a per-theme basis also.

If there's a reason to mark this "won't fix" we can (it's certainly not the highest priority of all features) but I don't see an argument for that.

Wim Leers’s picture

Title: Add a theme setting for contextual links » Allow contextual links to be disabled for particular themes

Then it should not be a theme setting, but a contextual links module setting.

It makes zero sense for this to be a theme setting, because the contextual module is a module, not a theme. Plus, we cannot expect every theme to include this setting.

markdorison’s picture

Status: Needs review » Needs work

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

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now 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.

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

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now 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.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now 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.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now 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.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.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.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). 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.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now 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.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

larowlan’s picture

Status: Needs work » Closed (outdated)

Given you can't use layout builder with contextual links, and layout builder shows in the front-end theme - I think at this point this is outdated

There's been little interest in working on it in ~6 years so I think we should let sleeping dogs lie.