Problem/Motivation

There are some inconsistencies between how local tasks and local actions are handled.

For local tasks, there are 2 hooks:

For local actions, there is only one hook, and the naming convention is actually the opposite of local tasks:

Proposed resolution

As an immediate stop-gap, add the corresponding render alter hook, and to avoid API breakage, name it hook_local_actions_alter(). The ideal solution would be to swap the names so hook_menu_local_actions_alter() altered prior to rendering, but this involves an API change.

Remaining tasks

User interface changes

API changes

Possibly if renaming occurs for consistency. Otherwise no, but a Drupal WTF is introduced.

Data model changes

Comments

jhedstrom created an issue. See original summary.

jhedstrom’s picture

Status: Active » Needs review
Issue tags: +Needs tests
FileSize
2.25 KB

Here is an initial patch. It will need tests eventually.

jrockowitz’s picture

I definitely experienced a WTF moment with these hook naming conventions. I want to alter local actions labels and url when they are being rendered, so that I can add more contextual information like 'Add content to {this page}'.

dawehner’s picture

Wow yeah that is quite sad :(

So the runtime vs. non runtime hook is completely opposite, not sure how to deal with that at all.

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.

dawehner’s picture

@jhedstrom
Do you think we can provide a little test to ensure this actually works?

jhedstrom’s picture

Assigned: Unassigned » jhedstrom

@dawehner sure!

jhedstrom’s picture

Assigned: jhedstrom » Unassigned
FileSize
2.4 KB
2.4 KB
4.69 KB

Here's a test. The interdiff is the same as the test-only patch.

The last submitted patch, 8: 2585169-08-TEST-ONLY.patch, failed testing.

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.