This patch includes a preprocess function in addition to a twig template.

Comments

Status:Needs review» Fixed

looks good
RTBC

Thanks!

commited / pushed to front-end

Status:Fixed» Needs review

+++ b/core/includes/menu.inc
@@ -1665,6 +1665,23 @@ function theme_menu_local_action($variables) {
+function theme_menu_local_action($variables) {

replace by template_preprocess, now this patch throws error.
Also add &$variables

+++ b/core/includes/menu.inc
@@ -1665,6 +1665,23 @@ function theme_menu_local_action($variables) {
+    $variables['link'] = l($link['title'], $link['href'], isset($link['localized_options']) ? $link['localized_options'] : array());
+++ b/core/themes/stark/templates/menu.inc/menu-local-action.html.twig
@@ -0,0 +1,15 @@
+<li>{{ link }}</li>

I suppose to replace this by just variables for theme_link and use below in template {{ include "link.html.twig" }}

Status:Needs work» Needs review
StatusFileSize
new1.41 KB

#2 - (1) I correctly renamed theme_ to template_preprocess
#2 - (2) Do you think we need to segregate the l() link variable from the other two HTML text and htmlspecialchars() versions that were initially outputted by the theme_ function?

  if (isset($link['href'])) {
    $output .= l($link['title'], $link['href'], isset($link['localized_options']) ? $link['localized_options'] : array());
  }
  elseif (!empty($link['localized_options']['html'])) {
    $output .= $link['title'];
  }
  else {
    $output .= check_plain($link['title']);
  }

Status:Needs review» Needs work

+++ b/core/includes/menu.inc
@@ -1687,6 +1687,23 @@ function theme_menu_local_action($variables) {
+    $variables['link'] = check_plain($link['title']);

Needs work
Due to jenlampton comment here

+++ b/core/includes/menu.inc
@@ -1687,6 +1687,23 @@ function theme_menu_local_action($variables) {
+function template_preprocess_menu_local_action(&$variables) {

Could you mention your point here about doc block

@vlad.dancer:

Can you clarify what this...

+++ b/core/includes/menu.inc
@@ -1687,6 +1687,23 @@ function theme_menu_local_action($variables) {
+    $variables['link'] = check_plain($link['title']);

...has to do with #1819414-9: Convert theme_user_admin_roles?

Title:Convert theme_menu_local_action to twigConvert theme('menu_local_action') to Twig
Component:Twig templates» Twig templates conversion (front-end branch)
Assigned:Unassigned» steveoliver

Changing title; assigning myself, in preparation for menu.inc patch in #1898478: menu.inc - Convert theme_ functions to Twig.

Status:Needs work» Fixed

Closing this (instead of moving it to core queue) in favor of aggregated 'menu.inc' core issue #1898478: menu.inc - Convert theme_ functions to Twig. Git attributions to all participants will happen there.

Status:Fixed» Closed (fixed)

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