You are here

function social_content_report_node_links_alter in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_content_report/social_content_report.module \social_content_report_node_links_alter()
  2. 8.5 modules/social_features/social_content_report/social_content_report.module \social_content_report_node_links_alter()
  3. 8.6 modules/social_features/social_content_report/social_content_report.module \social_content_report_node_links_alter()
  4. 8.7 modules/social_features/social_content_report/social_content_report.module \social_content_report_node_links_alter()
  5. 8.8 modules/social_features/social_content_report/social_content_report.module \social_content_report_node_links_alter()
  6. 10.0.x modules/social_features/social_content_report/social_content_report.module \social_content_report_node_links_alter()
  7. 10.1.x modules/social_features/social_content_report/social_content_report.module \social_content_report_node_links_alter()
  8. 10.2.x modules/social_features/social_content_report/social_content_report.module \social_content_report_node_links_alter()

Implements hook_node_links_alter().

File

modules/social_features/social_content_report/social_content_report.module, line 120
The Social Content Report module file.

Code

function social_content_report_node_links_alter(array &$links, NodeInterface $entity, array &$context) {
  if ($context['view_mode'] === 'full') {
    $link = \Drupal::service('social_content_report.content_report_service')
      ->getModalLink($entity, 'report_node', TRUE);
    if ($link) {
      $links['moderation'] = [
        '#theme' => 'links__node__moderation',
        '#links' => [
          'report' => $link,
        ],
        '#attributes' => [
          'class' => [
            'links',
            'inline',
          ],
        ],
      ];
    }
  }
}