I am engaged on a theme for a Drupal 8.Eight undertaking. I’ve applied hook_menu_links_discovered_alter() in my
.theme file – however Drupal does not appear to be invoking it, and I do not perceive why.
(For context: my purpose is to make some modifications to the “Log in” and “Log off” hyperlinks on the consumer account menu. I’ve discovered quite a few examples on-line which say that that is the proper hook to make use of for this objective.)
Here is what I’ve tried:
I’ve checked (a dozen occasions) that I am utilizing the right operate title, with the right signature:
die('in hook')in my hook operate to find out whether or not it is even being known as. (It is not.)
I’ve cleared cache many occasions, from each the Drupal internet dashboard and through
drush cr. No luck.
I’ve seen that Drupal generally takes some time to note adjustments to
.themerecordsdata, even after you’ve got cleared cache. So, to be completely positive that Drupal is utilizing the most recent model of the file, I’ve added
echostatements to different (already-working) hooks. This has confirmed that Drupal is utilizing the most recent model of the file – however
mythemename_menu_links_discovered_alter()nonetheless is not being known as.