diff -u b/core/lib/Drupal/Core/Render/Element/SystemCompactLink.php b/core/lib/Drupal/Core/Render/Element/SystemCompactLink.php --- b/core/lib/Drupal/Core/Render/Element/SystemCompactLink.php +++ b/core/lib/Drupal/Core/Render/Element/SystemCompactLink.php @@ -7,6 +7,9 @@ namespace Drupal\Core\Render\Element; +use Drupal\Core\Url; +use Drupal\Component\Utility\NestedArray; + /** * Provides a link render element to show or hide inline help descriptions. * @@ -38,14 +41,14 @@ * Doing so during pre_render gives modules a chance to alter the link parts. * * @param array $element - * A structured array whose keys form the arguments to l(): - * - #title: The link text to pass as argument to l(). + * A structured array whose keys form the arguments to Drupal::l(): + * - #title: The link text to pass as argument to Drupal::l(). * - One of the following: * - #route_name and (optionally) a #route_parameters array; The route * name and route parameters which will be passed into the link * generator. - * - #href: The system path or URL to pass as argument to l(). - * - #options: (optional) An array of options to pass to l() or the link + * - #href: The system path or URL to pass as argument to Drupal::l(). + * - #options: (optional) An array of options to pass to Drupal::l() or the link * generator. * * @return array @@ -56,23 +59,25 @@ $element += array('#options' => array()); if (system_admin_compact_mode()) { - $element['#title'] = t('Show descriptions'); - $element['#route_name'] = 'system.admin_compact_page'; - $element['#route_parameters'] = array('mode' => 'off'); + $element['#title'] = \Drupal::translation()->translate('Show descriptions'); + $element['#url'] = Url::fromRoute('system.admin_compact_page', array('mode' => 'off')); $element['#options'] = array( - 'attributes' => array('title' => t('Expand layout to include descriptions.')), + 'attributes' => array('title' => \Drupal::translation()->translate('Expand layout to include descriptions.')), 'query' => drupal_get_destination(), ); } else { - $element['#title'] = t('Hide descriptions'); - $element['#route_name'] = 'system.admin_compact_page'; - $element['#route_parameters'] = array('mode' => 'on'); + $element['#title'] = \Drupal::translation()->translate('Hide descriptions'); + $element['#url'] = Url::fromRoute('system.admin_compact_page', array('mode' => 'on')); $element['#options'] = array( - 'attributes' => array('title' => t('Compress layout by hiding descriptions.')), + 'attributes' => array('title' => \Drupal::translation()->translate('Compress layout by hiding descriptions.')), 'query' => drupal_get_destination(), ); } + + $options = NestedArray::mergeDeep($element['#url']->getOptions(), $element['#options']); + $element['#markup'] = \Drupal::l($element['#title'], $element['#url']->setOptions($options)); + return $element; } diff -u b/core/modules/system/css/system.admin.css b/core/modules/system/css/system.admin.css --- b/core/modules/system/css/system.admin.css +++ b/core/modules/system/css/system.admin.css @@ -28,7 +28,7 @@ } /** - * System compact link: to toggle the display of description text. + * Markup generated by theme_system_compact_link(). */ .compact-link { margin: 0 0 0.5em 0; @@ -69,7 +69,7 @@ } /** - * Markup generated by theme_system_compact_link(). + * System compact link: to toggle the display of description text. */ .compact-link { margin: 0 0 0.5em 0; diff -u b/core/modules/system/system.module b/core/modules/system/system.module --- b/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -209,14 +209,13 @@ 'variables' => array('menu_items' => NULL), 'file' => 'system.admin.inc', ), - 'system_compact_link' => array( - 'variables' => array(), - 'function' => 'theme_system_compact_link', - ), )); } ), + 'system_compact_link' => array( + 'variables' => array(), + ), )); } only in patch2: unchanged: --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2994,6 +2994,7 @@ function drupal_render(&$elements, $is_root_call = FALSE) { $elements['#printed'] = TRUE; $elements['#markup'] = SafeMarkup::set($elements['#markup']); + return $elements['#markup']; }