Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293211

Remove theme_more_link() and replace with #type 'more_link'

$
0
0

Here is the current code for theme_more_link():

<?php
function theme_more_link($variables) {
  return
'<div class="more-link">'. l(t('More'), $variables['url'], array('attributes'=> array('title'=> $variables['title']))) . '</div>';
}
?>

In order to reproduce this with #type = link, we need to make a render array with the following structure:

<?php
$more_link
= array(
 
'#type'=> 'link',
 
'#href'=> 'admin/content',
 
'#title'=> t('More'),
 
'#attributes'=> array(
   
'#title'=> t('Show more content'),
  ),
 
'#theme_wrappers'=> array('container'),
 
'#wrapper_container_attributes'=> array(
   
'class'=> array('more-link'),
  ),
);
?>

Part of #1595614: [meta] Remove all the theme functions and templates in core that simply output a link. Replace with #type 'link' render arrays

Related:
#1939098: Convert theme_more_link() to Twig


Viewing all articles
Browse latest Browse all 293211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>