Follow up from #1874664-110: Introduce toolbar level "Edit" mode that shows all contextual links. In that issue, we removed "Edit" as a primary tab (MENU_CONTEXT_PAGE) from node pages, and instead made it a contextual link (which it already was on all pages where a node is rendered other than its primary page) on the primary node page as well.

That has repercussions though:

  1. What if you disable contextual.module? Then, there's no link to edit a node from its view page. I suggested in #1874664-112: Introduce toolbar level "Edit" mode that shows all contextual links that that's ok, because you can still edit it from admin/content. After all, a link to edit a node from its view page is a "contextual" link (at least in the broad sense of the word "contextual", even if not in the narrower D7 sense), so losing that convenience when you disable the module shouldn't be a surprise.
  2. What about non-admins without "access contextual links" permission? I also suggested in that same comment that we remove that permission (similarly to how we don't have a "access local tasks" permission), but #1874664-111: Introduce toolbar level "Edit" mode that shows all contextual links lists some reasons why it may be desirable to have roles without access to contextual links, at least the way we currently render them.
  3. What about non-admins when contextual.module is disabled? This is an extension of the first point, but for people who don't have admin/content as an alternate. Perhaps we can change that listing page to a View that everyone has access to, but one that is filtered to only those items you can edit?

Or, maybe the responses to the above items are not good, and we need a fallback mechanism for important contextual links to automatically become primary tabs for users who can't access contextual links?

While the specific use case currently is the node's Edit link, it's possible that more items should move from tabs to contextual links, so per the issue title, let's evaluate with that broader perspective.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

effulgentsia’s picture

Priority: Normal » Major
Issue tags: +d8ux
FileSize
4.76 KB

Or, maybe the responses to the above items are not good, and we need a fallback mechanism for important contextual links to automatically become primary tabs for users who can't access contextual links?

Here's a patch that demonstrates that, but not setting this issue to "needs review", because we should first discuss whether this is the path we want to go down.

Gábor Hojtsy’s picture

Reposting slightly edited from #1874664: Introduce toolbar level "Edit" mode that shows all contextual links with additional notes below.

Reality is that Drupal displays these local tasks only for some high level objects and only if you view them on their own page. If you view a node in a Views view, in a block or as part of a Panels pane or a teaser in some other way, then you have no editing local task on the node. Also, if the high level object on the page (the main page object) is not a node or user, you pretty much don't get editing or other local tasks (eg. if your page is a view or panel). Also if you have anything displayed not as the main content object of your page (block, menu, etc.), you have no way to directly edit that either.

So the answer to "how do I edit this block", "how do I edit this view" or "how do I edit this node if its displayed with views (and the creator did not check to link title to the node page)" if you have no contextual links is the same: go to the admin page and try to find the object somehow to edit.

The proposed solution here makes it so regardless of where the node is displayed, whether it is a teaser or full node, and even whether it is a node page or view page or block or menu or panel or whatnot, you have the same way to do operations on it. You don't need to think "ah, this is a node, so I should go to it's page and edit it there" but "oh, this is a block so I'll need to manually find this in the admin UI". Instead of two competing affordances for operations on underlying page elements, people only need to learn one and can get to operations *faster* because these are even available on teaser views, etc.

The fact that full node pages (and user pages) have edit tabs on them is a legacy behaviour. Views, panels, blocks, menus, etc. don't have these, and blocks and menus don't even have a frontend "object page" where they are the main object for them to have an edit local task. If your site is built with panels with panes, or spaces+context with blocks, then you don't have "object pages" for your page components to go and hit the edit tab. This privilege for nodes and users and only if they are displayed on their own page is very one-off on the front-end where most things have no way to edit without contextual links.

I think it is a crucial question to pose whether it is worth it to maintain two separate experiences. One where you can edit some things via local tasks only if you view their full page display on their own page and one where contextual links not interfering with the site design appear for all kinds of objects granularly based on your permission levels for them in one unified fashion everywhere.

Local tasks are very-very limited and if Drupal wants to go beyond Wordpress' simplicity and provide real flexibility, we should not tie us to them IMHO.

catch’s picture

Note that comments currently have edit/delete links displayed inline, in all contexts, but not using contextual links.

So while it's an inconsistent experience, you get the tab on nodes and the links on comments without that module enabled, but now only for comments. That makes going to admin/content more of an obvious regression from Drupal 7 for me, than if you had to do it for both.

We don't have contextual links on comments because the original Drupal 7 patch to add contextual links to comments led to a menu_get_item() call for every comment on a page (i.e. a separate query to the router table for each comment), unfortunately that bug has never been fixed and the patch was rolled back instead. I've re-opened the original bug report it now the contextual links usage has broadened beyond admins, at #607244: Decrease performance impact of contextual links.

Gábor Hojtsy’s picture

Status: Active » Needs review
FileSize
10.58 KB
67.51 KB

Here is a patch to move towards unified use of contextual links instead of tabs on front end objects. This is not a competing patch for the above, in fact the two can possibly be merged if we want these to re-appear as tabs when contextual module is not on. But as said above, people loose a whole lot more without contextual links.

The following changes were needed:

NODES
- make translation tabs inline actions (both legacy translation module and entity translation module)
- make book outline inline action
- document title suffix containing contextual links

USERS:
- make editing, shortcuts, contact, openid and tracker inline actions (NOW this is going to be controversial and definitely need extensive discussion, not all of these are administrative actions; users edit their own accounts regularly and others contact users or track their posts)
- introduce render controller for users to add contextual links when not in compact mode (eg. when rendering user picture on nodes)
- add title suffix (where contextual links get rendered) and fix bug around attributes that was pre-existing, so the links show up

TERMS:
- make all taxonomy term local tabs into inline actions
- add contextual links to render controller
- add title suffix to template (same as above)

This results in:

EditAllOver.png

Now for the weaknesses. Obviously many of the user actions are navigational. Eg. contacting a user or looking at what the user posted are not really actions on the user and not backend operations either that would need to be hidden away like this. Also a user herself to be able to edit her account requiring an admin action is very odd. So I think the application of this to users is weak.

Then for taxonomy terms, there is a rendering artefact. Although the above screenshot shows I see the taxonomy term contextual links, reality is if there is no description for the term, there is no space to display the pencil (the main taxonomy term area is 0px high), so they will just not be visible. I think things like this are artefacts that we should be able to resolve by for example figuring out how to move up the main objects' contextual links to the page title instead of the content below the title. That clearly needs more work.

As for comments on entities as @catch mentions, they also need the "reply" link at least to be well discoverable I guess, and then moving the rest to a contextual area would group the admin tasks into the contextual operations while reply would be kept as a frontend feature.

Gábor Hojtsy’s picture

Made an attempt at moving the admin comment links (edit/delete/approve/translate) as summarised by @sun at #607244: Decrease performance impact of contextual links to contextual links too. The comment module is a pretty big hodgepodge of stuff, so this is not very trivial. The patch goes as far as doing this for "delete", and the above patch already does translate, but edit and approve are much trickier.

Edit: all comment menu paths use comment/% (not loading comment directly) but edit uses comment/%comment directly. It has a comment saying this is for performance, but I don't really understand why. Entity loading is cached as far as I understand. Not sure why most comment paths NOT load the full comment entity up front.

Approve: this has one more issue, namely the approve operation should only show up if the comment is not published yet which could be coded into menu item access (so long as contextual links are based off menu items); it also gets a form token to avoid XSS since it directly approves comments instead of with a confirmation form; there is no current way to add such one-off addendums to contextual links

There is also a bug with how contextual links are engaged, eg. when you open down a comment's contextual links the parent node's contextual links also open.

Of course this also has all the performance implications outlined by @catch at #607244: Decrease performance impact of contextual links.

Status: Needs review » Needs work

The last submitted patch, local-actions-as-contextual-5.patch, failed testing.

Gábor Hojtsy’s picture

BTW I realize the issue is about what to do if most of these changes are made, but since most of these changes are not made yet, I thought it would be paramount to come up with the extent of the changes first. Maybe I should have opened yet another issue around this actually.

Dave Reid’s picture

I don't really agree with moving everything into contextual links for the issue brought up in #4. Local tasks are commonly used in the wild as navigation elements, and not administrative tasks. Views UI allows us to create arbitrary views at local tasks and they are commonly used as 'tabs' on nodes for more information, profile pages under users, etc. Replacing this pattern with contextual links seems contrary to the intent of contextual links.

Wim Leers’s picture

Status: Needs work » Active

Please see this comment at the parent issue: #1882482-104: [meta] Unify editing approaches in Drupal.

Trying to build consensus. I think we're actually closer than I remembered :)

tim.plunkett’s picture

In that issue, we removed "Edit" as a primary tab (MENU_CONTEXT_PAGE) from node pages, and instead made it a contextual link

We probably should have rolled that back. Or at least added back the local tasks.

webchick’s picture

Priority: Major » Normal

We did roll that part of the patch back, didn't we? I see "View" and "Edit" tabs on my D8 install on node/1.

That probably makes this issue mostly irrelevant now. And probably not "major."

webchick’s picture

Issue summary: View changes

Updated issue summary.

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.

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.

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

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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

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

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.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.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.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.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.