API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Menu%21me...

> This hook is invoked by menu_local_tasks().

That function is marked as deprecated.

CommentFileSizeAuthor
#7 2850010-7.patch781 bytesanish.a

Comments

joachim created an issue. See original summary.

alex_optim’s picture

Assigned: Unassigned » alex_optim
alex_optim’s picture

Assigned: alex_optim » Unassigned
vmachado’s picture

Assigned: Unassigned » vmachado
vmachado’s picture

@joachim
Please, could you add more details about what should be done in this issue?

joachim’s picture

Sure.

The documentation for hook_menu_local_tasks_alter() mentions the function menu_local_tasks().

However, if you follow the link to read about menu_local_tasks(), you will see that it is marked as deprecated. That means that it shouldn't be used. The documentation for menu_local_tasks() unfortunately doesn't tell you what you should use instead. (Ideally it should, but that is another separate problem.)

The documentation for hook_menu_local_tasks_alter() therefore should be updated, so it refers to the new thing you should use instead of menu_local_tasks().

So the steps to fix are:

1. research what should be used instead of menu_local_tasks()
2. replace the mention of menu_local_tasks() with the new thing

anish.a’s picture

Status: Active » Needs review
StatusFileSize
new781 bytes

Found that \Drupal\Core\Menu\LocalTaskManager::getLocalTasks() invokes this. Changed the documentation. Please review.

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Good detective work!

And patch looks perfect. Thanks!

xjm’s picture

Title: hook_menu_local_tasks_alter() docs refer to deprecated function » Remove documentation references to deprecated function menu_local_tasks()
Version: 8.4.x-dev » 8.3.x-dev
Status: Reviewed & tested by the community » Needs work

There are several more docs references to this deprecated function that we should fix in the same patch:

[ibnsina:drupal | Sat 17:56:38] $ grep -r "menu_local_tasks" * | grep "\*"
core/includes/menu.inc: * @see hook_menu_local_tasks_alter()
core/lib/Drupal/Core/Menu/LocalTaskManagerInterface.php:   * @see hook_menu_local_tasks_alter()
core/lib/Drupal/Core/Menu/menu.api.php: * hook_menu_local_tasks_alter().
core/lib/Drupal/Core/Menu/menu.api.php: * This hook is invoked by menu_local_tasks(). The system-determined tabs and
core/modules/contact/contact.module: * Implements hook_menu_local_tasks_alter().
core/modules/system/tests/modules/menu_test/menu_test.module: * Implements hook_menu_local_tasks_alter().
core/modules/views_ui/src/ViewFormBase.php:   * This function can be called from hook_menu_local_tasks_alter() to implement

For background information on why we should correct them all at once, see https://www.drupal.org/core/scope.

Thanks for working on this!

As a documentation fix only, the scope I've set can also be backported to 8.3.x.

joachim’s picture

Looks like the only other mention is this one:

> core/lib/Drupal/Core/Menu/menu.api.php: * This hook is invoked by menu_local_tasks(). The system-determined tabs and

All the others are hook_menu_local_tasks_alter() which is fine.

(I am starting to wonder whether we should make sure that patches that deprecate something also handle the docs clean-up, or do it as a separate preparatory issue...)

tameeshb’s picture

Status: Needs work » Needs review

The one replaced in #7 looks like the only one.

tameeshb@imt3rabyt3 /v/w/h/drupal83> grep -r 'menu_local_tasks()' .
./core/lib/Drupal/Core/Menu/menu.api.php: * This hook is invoked by menu_local_tasks(). The system-determined tabs and
tameeshb@imt3rabyt3 /v/w/h/drupal83> 

RTBC?

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Yup.

  • xjm committed ab563ba on 8.4.x
    Issue #2850010 by anish.a, joachim, vmachado, tameeshb: Remove...
xjm’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +Needs followup

Note that grepping for menu_local_tasks() with closed parens is not sufficient, because the function call may be documented with arguments, in which case the parentheses may be separated, or as a callback, meaning no parentheses. So the remaining ones not caught by the grep in #11 are these:

core/includes/menu.inc:    '#theme' => 'menu_local_tasks',
core/includes/theme.inc:    'menu_local_tasks' => array(
core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php:      '#theme' => 'menu_local_tasks',

However, those are not actually documentation references. So indeed, the current patch works for the extended scope. Thanks for double-checking and sorry for the extra review!

We probably need a followup though to actually remove the places where it's being used as a theme function, so tagging for that.

By the way, for some info on how we will be changing our process on deprecation in the future, see:

We will also require full removals in advance of Drupal 9:
#2607260: [meta] Core deprecation message introduction, contrib testing etc.

  • xjm committed 2183f58 on 8.3.x
    Issue #2850010 by anish.a, joachim, vmachado, tameeshb: Remove...
tameeshb’s picture

@xjm, I had thought of the params so I also grepped using, "menu_local_tasks(" but didn't know about the callback part without any parentheses, thanks :D

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.