You are here

protected function Link::outputAsActionLink in Views link area 8

Takes the generated link and transforms it into a 'local action' link.

Wrapping with hard-coded HTML is ugly but basically copied from \Drupal\block\Controller\BlockLibraryController::buildLocalActions()

Parameters

array $link: The link to transform.

Return value

array The render array for the generated action link.

1 call to Link::outputAsActionLink()
Link::renderUrl in src/Plugin/views/area/Link.php
Takes an input \Drupal\Core\Url object and outputs it as needed.

File

src/Plugin/views/area/Link.php, line 490

Class

Link
Views area Link handler.

Namespace

Drupal\views_linkarea\Plugin\views\area

Code

protected function outputAsActionLink(array $link) {
  $action_link = [
    '#theme' => 'menu_local_action',
    '#link' => [
      'url' => $link['#url'],
      'title' => $link['#title'],
    ],
  ];
  $prefix = isset($link['prefix']) ? $link['prefix'] : '';
  $suffix = isset($link['suffix']) ? $link['suffix'] : '';
  $action_link['#prefix'] = $prefix . '<ul class="action-links">';
  $action_link['#suffix'] = '</ul>' . $suffix;
  return $action_link;
}