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...
Comment | File | Size | Author |
---|---|---|---|
#8 | contextual-629160-8.patch | 3.96 KB | dev.cmswebsiteservices |
#6 | contextual-629160-6.patch | 3.77 KB | dev.cmswebsiteservices |
#4 | contextual-629160-4.patch | 3.35 KB | dev.cmswebsiteservices |
contextual-links-theme-setting.patch | 4.42 KB | David_Rothstein | |
Comments
Comment #1
David_Rothstein CreditAttribution: David_Rothstein commentedReally 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...
Comment #2
sunI 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).
Comment #3
David_Rothstein CreditAttribution: David_Rothstein commented#626286: Make contextual links a module was committed, so this would need a reroll.
Comment #4
dev.cmswebsiteservices CreditAttribution: dev.cmswebsiteservices commentedPlease see the patch, theme settings should now work as per requirements.
Comment #6
dev.cmswebsiteservices CreditAttribution: dev.cmswebsiteservices commentedComment #8
dev.cmswebsiteservices CreditAttribution: dev.cmswebsiteservices commentedComment #9
Dries CreditAttribution: Dries commentedI'd vote to postpone this to D8.
Comment #10
effulgentsia CreditAttribution: effulgentsia commentedI 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.
Comment #11
sunComment #12
David_Rothstein CreditAttribution: David_Rothstein commentedThe 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 :)
Comment #13
-osiris- CreditAttribution: -osiris- commentedComment #14
dqdI 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.
^^ 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.
Comment #15
Bojhan CreditAttribution: Bojhan commentedYup, 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.
Comment #16
Wim LeersComment #17
catchComment #19
Wim LeersTheme settings are a thing that's going away. Instead, we should allow a theme's
*.info.yml
file to specify acontextual_links: false
flag, for example.Comment #20
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedPer #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.
Comment #21
Wim LeersThen 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.
Comment #22
markdorisonComment #34
larowlanGiven 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.