Active
Project:
Drupal core
Version:
main
Component:
contextual.module
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
13 Feb 2013 at 18:48 UTC
Updated:
22 Apr 2022 at 05:22 UTC
Jump to comment: Most recent
Problem:
- Views has contextual links that appear when a View is rendered as a page, and those contextual links appear to the right of the page title (the <h1> element), but the code Views uses to achieve this is ugly: see views_page_alter(), views_preprocess_html(), and views_contextual_links_view_alter().
- As of #1874664: Introduce toolbar level "Edit" mode that shows all contextual links, contextual links for nodes now appear on the node page itself, but they are attached to the node's <article> tag, which does not include the page title.
Questions:
<h1> tag, as in how views pages currently works, or not, as in how node pages currently work?
Comments
Comment #1
wim leersI can offer another angle…
The real problem here is Drupal's "page title" concept.
If a node is rendered in the teaser view mode, then the node title is inside the
<article class="node">tag, i.e. all of the node's fields are properly contained. The "page title" is something else than the node title.But, if a node is rendered in the full view mode, then the node title is outside the
<article class="node">tag, i.e. not all of the node's fields are properly contained. The "page title" is the node title.The latter caused a lot of hackery to make in-place editing work for node titles, because the semantic structure is no longer accurate.
Comment #2
gábor hojtsyI think there is very well a use case for contextual links and tabs appearing. For example, Views is regularly used to create different pages using tabs between them as navigation. The tabs are not actions on the views, but rather each tab is a view or a different display of a view. So the contextual link actions are on the View but the tabs are unrelated to the view's backend tasks.
Experimenting with adding contextual links to taxonomy term pages in #1915730: Decide what to do about important contextual links when that module is disabled or restricted also showed that if all of the content of the object is a title (ie. no description on the term), then there is nothing to display below the title before the list of nodes is displayed, so if contextual links are used in place of tabs, then there is no place to display them. If you enter a description, it will naturally provide space for the contextual links (like the node body or any other first field or authoring information on the node).
So I think there is a strong case to be made that the "main page object's" contextual links would be ideally carried over to the page title (if there is one) or the page title be made part of the main page object in containment (like Wim alluded to above).
Comment #3
jhedstromProbably needs to wait until 8.1.
Comment #4
effulgentsia commentedIt's been a while since I opened this. Some of what's in the original issue summary might have already been fixed. In which case, are there any problems left with what's in HEAD? Depending on the answer, some might still be solvable without disrupting APIs, or we can close this issue entirely, so moving back to 8.0.x until that's answered.
Comment #5
wim leersChanges since February 2013
It's actually in exactly the same state as it was before; none of this architecture has changed, so the same problems exist.
BUT:
$page['#title'](where$pageis the render array returned by the main content controller) is now allowed to be HTML. So this part from the IS is not actually a problem anymore: .#contextual_linksproperty set. That works just fine. I don't think it makes sense to abstract it away furtherThe 4 questions
To answer the 4 questions in the IS:
Comment #16
larowlanIs item 2 less of an issue now that quickedit is out of core?