diff -u b/core/lib/Drupal/Core/Form/ConfirmFormHelper.php b/core/lib/Drupal/Core/Form/ConfirmFormHelper.php --- b/core/lib/Drupal/Core/Form/ConfirmFormHelper.php +++ b/core/lib/Drupal/Core/Form/ConfirmFormHelper.php @@ -34,17 +34,16 @@ // If a destination is specified, that serves as the cancel link. if ($query->has('destination')) { $options = UrlHelper::parse($query->get('destination')); - return array( - '#type' => 'link', - '#title' => $form->getCancelText(), + $link = array( '#href' => $options['path'], '#options' => $options, ); } // Check for a route-based cancel link. elseif ($url = $form->getCancelUrl()) { - return $url->toRenderArray($form->getCancelText()); + $link = $url->renderArrayProperties(); } + $link['#type'] = 'link'; $link['#title'] = $form->getCancelText(); return $link; diff -u b/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php --- b/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -379,25 +379,18 @@ /** * Returns the route information for a render array. * - * @param string $title - * The title for the render array. - * * @return array * An associative array suitable for a render array. */ - public function toRenderArray($title = '') { + public function renderArrayProperties() { if ($this->isExternal()) { return array( - '#type' => 'link', - '#title' => $title, '#href' => $this->getPath(), '#options' => $this->getOptions(), ); } else { return array( - '#type' => 'link', - '#title' => $title, '#route_name' => $this->getRouteName(), '#route_parameters' => $this->getRouteParameters(), '#options' => $this->getOptions(), @@ -447,7 +440,7 @@ * Checks a Url render element against applicable access check services. * * @param array $element - * A render element as returned from \Drupal\Core\Url::toRenderArray(). + * A render element as returned from \Drupal\Core\Url::renderArrayProperties(). * * @return bool * Returns TRUE if the current user has access to the url, otherwise FALSE. diff -u b/core/modules/comment/src/Form/CommentAdminOverview.php b/core/modules/comment/src/Form/CommentAdminOverview.php --- b/core/modules/comment/src/Form/CommentAdminOverview.php +++ b/core/modules/comment/src/Form/CommentAdminOverview.php @@ -197,13 +197,18 @@ $options[$comment->id()] = array( 'title' => array('data' => array('#title' => $comment->getSubject() ?: $comment->id())), 'subject' => array( - 'data' => $comment_permalink->toRenderArray($comment->getSubject()), + 'data' => array( + '#type' => 'link', + '#title' => $comment->getSubject(), + ) + $comment_permalink->renderArrayProperties(), ), 'author' => drupal_render($username), 'posted_in' => array( - 'data' => $commented_entity->urlInfo()->toRenderArray($commented_entity->label()) + array( + 'data' => array( + '#type' => 'link', + '#title' => $commented_entity->label(), '#access' => $commented_entity->access('view'), - ), + ) + $commented_entity->urlInfo()->renderArrayProperties(), ), 'changed' => $this->dateFormatter->format($comment->getChangedTime(), 'short'), ); diff -u b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php --- b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php +++ b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php @@ -73,7 +73,11 @@ // If the link is to be displayed and the entity has a uri, display a // link. if ($this->getSetting('link') && $uri = $referenced_entity->urlInfo()) { - $elements[$delta] = $uri->toRenderArray($label); + $elements[$delta] = array( + '#type' => 'link', + '#title' => $label, + ) + $uri->renderArrayProperties(); + if (!empty($item->_attributes)) { $elements[$delta]['#options'] += array('attributes' => array()); $elements[$delta]['#options']['attributes'] += $item->_attributes; diff -u b/core/modules/image/src/Form/ImageEffectFormBase.php b/core/modules/image/src/Form/ImageEffectFormBase.php --- b/core/modules/image/src/Form/ImageEffectFormBase.php +++ b/core/modules/image/src/Form/ImageEffectFormBase.php @@ -93,7 +93,10 @@ '#type' => 'submit', '#button_type' => 'primary', ); - $form['actions']['cancel'] = $this->imageStyle->urlInfo('edit-form')->toRenderArray($this->t('Cancel')); + $form['actions']['cancel'] = array( + '#type' => 'link', + '#title' => $this->t('Cancel'), + ) + $this->imageStyle->urlInfo('edit-form')->renderArrayProperties(); return $form; } diff -u b/core/modules/node/src/NodeListBuilder.php b/core/modules/node/src/NodeListBuilder.php --- b/core/modules/node/src/NodeListBuilder.php +++ b/core/modules/node/src/NodeListBuilder.php @@ -101,9 +101,11 @@ $options = $uri->getOptions(); $options += ($langcode != LanguageInterface::LANGCODE_NOT_SPECIFIED && isset($languages[$langcode]) ? array('language' => $languages[$langcode]) : array()); $uri->setOptions($options); - $row['title']['data'] = $uri->toRenderArray($entity->label()) + array( + $row['title']['data'] = array( + '#type' => 'link', + '#title' => $entity->label(), '#suffix' => ' ' . drupal_render($mark), - ); + ) + $uri->renderArrayProperties(); $row['type'] = String::checkPlain(node_get_type_label($entity)); $row['author']['data'] = array( '#theme' => 'username', diff -u b/core/modules/system/src/Controller/DbUpdateController.php b/core/modules/system/src/Controller/DbUpdateController.php --- b/core/modules/system/src/Controller/DbUpdateController.php +++ b/core/modules/system/src/Controller/DbUpdateController.php @@ -213,8 +213,10 @@ $url = new Url('system.db_update', array('op' => 'selection')); $build['link'] = array( + '#type' => 'link', + '#title' => $this->t('Continue'), '#attributes' => array('class' => array('button', 'button--primary')), - ) + $url->toRenderArray($this->t('Continue')); + ) + $url->renderArrayProperties(); return $build; } @@ -341,9 +343,11 @@ } $url = new Url('system.db_update', array('op' => 'run')); $build['link'] = array( + '#type' => 'link', + '#title' => $this->t('Apply pending updates'), '#attributes' => array('class' => array('button', 'button--primary')), '#weight' => 5, - ) + $url->toRenderArray($this->t('Apply pending updates')); + ) + $url->renderArrayProperties(); } return $build; diff -u b/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php --- b/core/modules/taxonomy/src/Form/OverviewTerms.php +++ b/core/modules/taxonomy/src/Form/OverviewTerms.php @@ -221,9 +221,11 @@ '#size' => $term->depth, ); } - $form['terms'][$key]['term'] = $term->urlInfo()->toRenderArray($term->getName()) + array( + $form['terms'][$key]['term'] = array( '#prefix' => !empty($indentation) ? drupal_render($indentation) : '', - ); + '#type' => 'link', + '#title' => $term->getName(), + ) + $term->urlInfo()->renderArrayProperties(); if ($taxonomy_vocabulary->hierarchy != TAXONOMY_HIERARCHY_MULTIPLE && count($tree) > 1) { $parent_fields = TRUE; $form['terms'][$key]['term']['tid'] = array( diff -u b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/LinkFormatter.php b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/LinkFormatter.php --- b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/LinkFormatter.php +++ b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/LinkFormatter.php @@ -39,7 +39,10 @@ else { /** @var $term \Drupal\taxonomy\TermInterface */ $term = $item->entity; - $elements[$delta] = $term->urlInfo()->toRenderArray($term->getName()); + $elements[$delta] = array( + '#type' => 'link', + '#title' => $term->getName(), + ) + $term->urlInfo()->renderArrayProperties(); if (!empty($item->_attributes)) { $elements[$delta]['#options'] += array('attributes' => array()); only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/EntityForm.php +++ b/core/lib/Drupal/Core/Entity/EntityForm.php @@ -222,7 +222,7 @@ protected function actions(array $form, FormStateInterface $form_state) { 'class' => array('button', 'button--danger'), ), ); - $actions['delete'] += $route_info->toRenderArray(); + $actions['delete'] += $route_info->renderArrayProperties(); } return $actions; only in patch2: unchanged: --- a/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php +++ b/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php @@ -113,7 +113,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta $link = array( '#type' => 'link', '#title' => $this->menuLink->getTitle(), - ) + $this->menuLink->getUrlObject()->toRenderArray(); + ) + $this->menuLink->getUrlObject()->renderArrayProperties(); $form['path'] = array( 'link' => $link, '#type' => 'item',