Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Symlink

Security covered Under active development 12 sites

This module creates special content items that link to other content. This helps solve a problem where having multiple menu links pointing to the same internal page can cause breadcrumbs and menu trails to display incorrectly. By treating each link as a separate item, the module ensures that the site's navigation remains predictable.

Synopsis

Symlink is a module that solves a problem that many people are experiencing when they add more than one menu item pointing to the same internal link. This will cause the menu trail to act erratically.

Symlink will create a custom content type that will render any node it's referencing. That way, from the Drupal's point of view, this will be a completely different node every time even if it is always pointing to the same link, and the menu trail and breadcrumb will work in a more predictable fashion.

The problem

Imagine that you have an amazing tool available in your Drupal site at the address http://your_site/amazing_tool. And imagine that the site have several sections, and that each section needs to have a link to the amazing tool in its menu structure. This could result into a structure looking similar to the following ...

Section 1
├── Item 1.1
│ ├── Item 1.1.1
│ └── Link to the amazing tool <----- First instance
┊
┊
Section 2
├── Item 2.1
│ │
│ ├── Item 2.2.1
│ ├── Item 2.2.2
│ ├── Item 2.2.3
│ └── Link to the amazing tool <----- Second instance
┊
┊
Section 3
├── Item 3.1
│ ├── Item 3.2.1
│ ├── Item 3.2.2
│ ├── Item 3.2.3
│ └── Link to the amazing tool <----- Third instance
┊

Now the big problem here is that only one of the menu items labelled "Link to the amazing tool" will actually work. What seems to be happening is that because the target of all these 3 links will be http://your_site/amazing_tool, if you try to navigate to one of them, Drupal will stop searching as soon as it finds a match. I think that this will end up being the link that has the lowest mlid (menu link DB identifier). That's basically the first of the 3 items that was created. So if someone was already visiting a page under Section 2, then a click on the second instance of the link to the amazing tool will take them to the tool alright, but the menu trail and the breadcrumb will show that they are now in Section 1.

Solution and Features

  1. Symlinks are nodes.
  2. When viewing a node, the Symlink module will display a tab for adding a new symlink.
  3. When viewing the symlink, the "Add symlink" tab will be visible since symlinks are also nodes
  4. Additional symlinks can be created from other symlink, but they will always reference the original target node.
  5. A permission called "create symlink content" let's you control who can create a symlink.
  6. The symlink module is available for both Drupal 7 (D7) and Drupal 8 (D8)
  7. Contextual links still work. This let's you edit the original node.

Requirements

Contributed modules: none
Drupal core module: Text Field.

Known problems

This module is not using any official reference module (node reference or entity reference). This choice was intentional for the sake of simplicity during this first iteration.

Pledges

I pledge that this project is available for Drupal 7 and Drupal 8!

Credits

We are open to suggestions.

Dependencies

None

Road map

  • Add a configuration page for setting some default behaviours.
  • Add an option for auto-granting the permission if the user has access to creating content for the node type being symlink'ed
  • Considering if symlinks should be entities instead of nodes.
  • Creating an API to make anything symlinkable (Views, Entities, etc.)
  • Considering if the entity reference module should be used for the target or not.
  • When deleting a symlink, rename the delete button so that it reads "Delete
    Symlink"
  • For a symlink, add a new tab that reads "Edit original node" and rename the
    default "Edit" tab to make it read "Edit symlink".
  • Provide various reports showing all the symlinks and theirs target nodes.
  • Use hooks to remove a symlink when the target node is deleted.

Project Application Issue: https://www.drupal.org/node/2730445

Ask your assistant about Symlink

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Mar 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core PHP Release date
2.0.0-beta1 Pre-release 8–10 Mar 13, 2023