public static function renderLinks($post_entity_id, $view_mode, $langcode, $is_in_preview) {
    $links = [
      '#theme' => 'links',
      '#pre_render' => ['drupal_pre_render_links'],
      '#attributes' => ['class' => ['links', 'inline']],
    ];

    if (!$is_in_preview) {
      $entity = Post::load($post_entity_id)->getTranslation($langcode);
      $links['post'] = static::buildLinks($entity, $view_mode);

      // Allow other modules to alter the post links.
      $hook_context = [
        'view_mode' => $view_mode,
        'langcode' => $langcode,
      ];
      \Drupal::moduleHandler()->alter('post_links', $links, $entity, $hook_context);
    }
    return $links;
  }
public static function renderLinks($post_entity_id, $view_mode, $langcode, $is_in_preview) {
    $links = [
      '#theme' => 'links',
      '#pre_render' => ['drupal_pre_render_links'],
      '#attributes' => ['class' => ['links', 'inline']],
    ];

    if (!$is_in_preview) {
      $entity = Post::load($post_entity_id)->getTranslation($langcode);
      $links['post'] = static::buildLinks($entity, $view_mode);

      // Allow other modules to alter the post links.
      $hook_context = [
        'view_mode' => $view_mode,
        'langcode' => $langcode,
      ];
      \Drupal::moduleHandler()->alter('post_links', $links, $entity, $hook_context);
    }
    return $links;
  }
public static function renderLinks ( $ post_entity_id , $ view_mode , $ langcode , $ is_in_preview ) { $ links = [ '#theme' => 'links' , '#pre_render' => [ 'drupal_pre_render_links' ] , '#attributes' => [ 'class' => [ 'links' , 'inline' ] ] , ] ; if ( ! $ is_in_preview ) { $ entity = Post :: load ( $ post_entity_id ) -> getTranslation ( $ langcode ) ; $ links [ 'post' ] = static :: buildLinks ( $ entity , $ view_mode ) ; // Allow other modules to alter the post links. $ hook_context = [ 'view_mode' => $ view_mode , 'langcode' => $ langcode , ] ; \ Drupal :: moduleHandler ( ) -> alter ( 'post_links' , $ links , $ entity , $ hook_context ) ; } return $ links ; }
Lazy_builder callback; builds a post's links.

@param string $post_entity_id
The post entity ID.
@param string $view_mode
The view mode in which the post entity is being viewed.
@param string $langcode
The language in which the post entity is being viewed.
@param bool $is_in_preview
Whether the post is currently being previewed.

@return array
A renderable array representing the post links.
Lazy_builder callback ; builds a post s links .