Add a current link

Created on 15 December 2023, about 1 year ago

Problem/Motivation

Currently this module has links for 'previous', 'top' and 'next' but no link for the current node, nid.

As with the book module, there is a 'Navigation links for { page name } before the 'previous', 'up' and 'next' links

To reproduce the same layout as the 'Book module', I added the code below into the BookNavigationBlock.php file.

Added after line 130

 // Current link
    $current_nid = $book_link['nid'];
    // If this is the top, then the pid will be zero.
    if (is_numeric($current_nid) && $current_nid) {
      $current_link = [
        'nid' => $current_nid,
        'title' => Node::load($current_nid)->getTitle(),
      ];
      $navigation_links['current'] = $this->generateNodeLink($current_link);
    }

About the usage of this module

I am using this module on a 'localhost' server, nothing is live. It's a similar problem I had back in the days of D7's book module. I am not a programmer so I hope what I have added does not break anything.

Also good luck with making this module meet the security advisory policy and becoming a certified module

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom taxicab221

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024