menu local task and local actions are missing link context variables

Created on 13 November 2015, over 9 years ago
Updated 2 July 2025, about 1 month ago

I am trying to add custom class to the link ('a' tag) on menu local task with no success.
This is the code used:

<?php
{#
/**
 * @file
 * Bootstrap Barrio's Theme override for a local task link.
 *
 * Available variables:
 * - attributes: HTML attributes for the wrapper element.
 * - is_active: Whether the task item is an active tab.
 * - link: A rendered link element.
 *
 * Note: This template renders the content for each task item in
 * menu-local-tasks.html.twig.
 *
 * @see template_preprocess_menu_local_task()
 */
#}
<li{{ attributes.addClass(is_active ? 'active', 'nav-item') }}>{{ link(item.title, item.url, {'class' : 'nav-link' }) }}</li>
?>

Throwing this error:

[Fri Nov 13 02:22:39.011213 2015] [:error] [pid 2800:tid 1140] [client ::1:52515] Uncaught PHP Exception InvalidArgumentException: "The URI '' is invalid. You must use a valid URI scheme." at C:\\Bitnami\\drupal-8.0.0.rc2-0\\apps\\drupal\\htdocs\\core\\lib\\Drupal\\Core\\Url.php line 301, referer: http://localhost/drupal/node/2
✨ Feature request
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

theme system

Created by

πŸ‡΅πŸ‡ͺPeru hatuhay Lima

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for sharing your idea for improving Drupal.

    We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024