Drupal Association members fund grants that make connections all over the world.
Posted by thedavidmeister on
Change record status:
Published (View all published change records)
Introduced in branch:
- theme_link has been removed from core in order to improve rendering performance and because it no longer provides any benefits over calling l() directly.
- The attributes '#text' and '#path' have been changed to '#title' and '#href' respectively in order to provide consistent attribute naming throughout the Render API and Form API.
- Themers should replace '#theme' => 'link' with '#type' => 'link' in any render arrays, while also changing '#text' to '#title' and '#path' to '#href'.
- An '#options' attribute can be specified that will be passed to l() (and url() internally within l()) to specify extra options for the link such as query parameters, HTML attributes, etc.
- See for the reasoning behind this change.
- Themers should replace any hook_preprocess_link() implementations with a hook_link_alter() implementation. hook_link_alter() was added in .
$link_array = array( '#theme' => 'link', '#text' => 'The text to render inside the tag', '#path' => 'http://www.example.com/', ); drupal_render($link_array);
$link_array = array( '#type' => 'link', '#title' => 'The text to render inside the tag', '#href' => 'http://www.example.com/', ); drupal_render($link_array);
For additional examples demonstrating usage of both '#options' and hook_link_alter(), please reference https://drupal.org/node/1819788.