Commit ec029471 authored by catch's avatar catch
Browse files

Issue #2828680 by raman.b, bandanasharma, mogtofu33, drclaw, damontgomery,...

Issue #2828680 by raman.b, bandanasharma, mogtofu33, drclaw, damontgomery, tanubansal, paulocs, amietpatial, Chi, borisson_: Missing ul wrapper on forum local action links

(cherry picked from commit 290d4049)
parent 8b1bfc8f
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -294,7 +294,6 @@ protected function buildActionLinks($vid, TermInterface $forum_term = NULL) {
      if ($this->nodeAccess->createAccess($type)) {
        $node_type = $this->nodeTypeStorage->load($type);
        $links[$type] = [
          '#attributes' => ['class' => ['action-links']],
          '#theme' => 'menu_local_action',
          '#link' => [
            'title' => $this->t('Add new @node_type', [
@@ -323,15 +322,26 @@ protected function buildActionLinks($vid, TermInterface $forum_term = NULL) {
      // Anonymous user does not have access to create new topics.
      else {
        $links['login'] = [
          '#attributes' => ['class' => ['action-links']],
          '#theme' => 'menu_local_action',
          '#link' => [
            'title' => $this->t('Log in to post new content in the forum.'),
            'url' => Url::fromRoute('user.login', [], ['query' => $this->getDestinationArray()]),
          ],
          // Without this workaround, the action links will be rendered as <li>
          // with no wrapping <ul> element.
          // @todo Find a better way for this in https://www.drupal.org/node/3181052.
          '#prefix' => '<ul class="action-links">',
          '#suffix' => '</ul>',
        ];
      }
    }
    else {
      // Without this workaround, the action links will be rendered as <li> with
      // no wrapping <ul> element.
      // @todo Find a better way for this in https://www.drupal.org/node/3181052.
      $links['#prefix'] = '<ul class="action-links">';
      $links['#suffix'] = '</ul>';
    }
    return $links;
  }