You are here

function forward_node_links_alter in Forward 8

Same name and namespace in other branches
  1. 8.3 forward.module \forward_node_links_alter()
  2. 8.2 forward.module \forward_node_links_alter()

Implements hook_node_links_alter().

File

./forward.module, line 42
Allows forwarding of entities by email.

Code

function forward_node_links_alter(array &$node_links, NodeInterface $node, array &$context) {
  $settings = \Drupal::config('forward.settings')
    ->get();
  if ($settings['forward_link_inline'] && $settings['forward_interface_type'] == 'link') {
    $show = \Drupal::service('forward.access_checker')
      ->isAllowed($settings, $node, $context['view_mode']) && empty($build['#forward_build']);
    if ($show) {
      $node_links += \Drupal::service('forward.link_builder')
        ->buildForwardEntityLink($node, $settings);
    }
  }
}