Project's page
https://www.drupal.org/sandbox/asiby/2653566
Git clone command
git clone http://git.drupal.org/sandbox/asiby/2653566.git symlink
Some modules I manually reviewed:
- https://www.drupal.org/node/2594957#comment-11216147
- https://www.drupal.org/node/2706919#comment-11216775
- https://www.drupal.org/node/2687395#comment-11216853
- https://www.drupal.org/node/2686395#comment-11217895
- https://www.drupal.org/node/2730511#comment-11220533
- https://www.drupal.org/node/2718335#comment-11222959
- https://www.drupal.org/node/2682243#comment-11234381
- https://www.drupal.org/node/2708919#comment-11254242
INTRODUCTION
-------------
Symlink is a module that solves a problem that many people are experiencing when they add more then one menu items
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.
THE SOLUTION
------------
The symlink module fixes this issue by providing the following 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.
Comments
Comment #2
asiby CreditAttribution: asiby as a volunteer and commentedComment #3
asiby CreditAttribution: asiby as a volunteer and commentedComment #4
asiby CreditAttribution: asiby as a volunteer and commentedComment #5
PA robot CreditAttribution: PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpsgitdrupalorgsandboxasiby2653566git
Fixed the git clone URL in the issue summary for non-maintainer users.
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #6
asiby CreditAttribution: asiby as a volunteer and commentedFixed all the wrapping to 80 colomns in README.txt
Comment #7
asiby CreditAttribution: asiby as a volunteer and commentedComment #8
asiby CreditAttribution: asiby as a volunteer and commentedComment #9
asiby CreditAttribution: asiby as a volunteer and commentedComment #10
asiby CreditAttribution: asiby as a volunteer and commentedComment #11
asiby CreditAttribution: asiby as a volunteer and commentedComment #12
asiby CreditAttribution: asiby as a volunteer and commentedComment #13
asiby CreditAttribution: asiby as a volunteer and commentedComment #14
asiby CreditAttribution: asiby as a volunteer and commentedComment #15
asiby CreditAttribution: asiby as a volunteer and commentedComment #16
asiby CreditAttribution: asiby as a volunteer and commentedComment #17
asiby CreditAttribution: asiby as a volunteer and commentedComment #18
asiby CreditAttribution: asiby as a volunteer and commentedComment #19
remkor CreditAttribution: remkor commentedI have downloaded this module, it worked good when I added symlink to test node. But when i tried to view that node through symlink this warning showed up:
Warning: Creating default object from empty value in symlink_node_view() (line 95 of /home/www/test/d7-symlink/sites/default/modules/symlink/symlink.module).
It seems that redundant node title wasn't properly removed, but when i changed line 95 from
$output['body']['#object']->title = '';
to
$output['#node']->title = '';
warning didn't showed up again (node title also).
Comment #20
asiby CreditAttribution: asiby as a volunteer and commentedThanks for reviewing my module.
Excellent finding. I fixed it as you suggested.
Do you mind telling me which version of Drupal you are using? Even though your finding and the related fix make perfect sense, I couldn't reproduce it. And this line that you are referring to is line #118 now. You may need need to pull a newer version from Git.
Thanks.
Comment #21
remkor CreditAttribution: remkor commentedTo test your module I have used Drupal 7.43 with Coder and Devel modules enabled.
I have pulled the newest version from git, no warnings showing up now. But still I see change at line #95 not #118, maybe I'm doing something wrong.
Comment #22
asiby CreditAttribution: asiby as a volunteer and commentedYou are right. Strange though. It's probably my IDE playing tricks. I had recently enabled the auto wrapping of the code at 80 columns. That's probably a bad idea.
OK then. The important is that the bug is now fixed.
Thanks for your review. Do but you think that this is RTBC?
Comment #23
bapi_22 CreditAttribution: bapi_22 as a volunteer and at Cybage Software Pvt Ltd. commentedHi asiby,
Your module looks good. See below comments which needs a little work:
1. As you are creating the Symlink for any node, So in the link field, the value should be auto populated and should not be editable by user.
2. If any User edit any Symlink content and fill the link field value with its self nid, Its breaking the site when you visit the page.
So there should be a validation for that.
Comment #24
asiby CreditAttribution: asiby as a volunteer and commentedDoh!!!
Good point. I missed that. I will lock the link to make it non editable.
Thanks pal.
Comment #25
remkor CreditAttribution: remkor commentedUser input in symlink field is not validated properly. I can enter any number (nid of non-existing node), any alphanumeric string and it will be saved. Validate the user input by checking if nid is number and is pointing to existing node.
Making field not editable by user is not enough, it's easy to circumvent.
Comment #26
asiby CreditAttribution: asiby as a volunteer and commentedThanks again guys. This is amazing. It show how important this review process is. People can always discover things about anything.
I have added a validation process for the symlink. Please do give it another try.
Comment #27
asiby CreditAttribution: asiby as a volunteer and commentedComment #28
asiby CreditAttribution: asiby as a volunteer and commentedComment #29
remkor CreditAttribution: remkor commentedWhen I add symlink directly by accessing
/node/add/symlink
, not by "Add symlink" tabnode/add/symlink?symlink=
, link field shouldn't be disabled.In function
symlink_node_validate
you just set errorAn invalid value was given for the Link field.
without any validation, consequently I can't add any symlink anymore ...Comment #30
asiby CreditAttribution: asiby as a volunteer and commentedI see. In the initial plans, it wasn't planned to add symlinks that way. That's why it says in the road map that we will later allow using entity references. That way, people can decide to go really crazy with what they want to add a symlink for. I can enable the symlink now, but it will introduce too many things that are planned for the next major iterations. And it is let flexible to have to just type a node ID vs navigating to the node and clicking on the "Add a symlink" tab.
This means that I might have to later hide the symlink item in the node/add page so that people do not just use it as regular node/add/xyz pages.
Does that make sense?
Comment #31
asiby CreditAttribution: asiby as a volunteer and commentedI have fixed the validation. I had missed that part when I was staging the code to be committed.
Comment #32
remkor CreditAttribution: remkor commentedOk, so it would be good to add in function
symlink_form_symlink_node_form_alter
some message when this statementif ($symlink !== NULL)
is false:Comment #33
asiby CreditAttribution: asiby as a volunteer and commentedThat makes perfect sense. I have just added it. Thanks for the suggestion.
So now, when someone tries to use node/add/symlink, the message will tell them NAY!!! lol
Cheers
Comment #34
remkor CreditAttribution: remkor commentedIn file
symlink.install
, line 37:I think this is for debug and not needed now.
Besides that, it looks good.
Comment #35
asiby CreditAttribution: asiby as a volunteer and commentedTrue. I should be more careful with these things. It is removed from the code now.
Comment #36
remkor CreditAttribution: remkor commentedOk, let's mark this RTB and see what will happen ...
Comment #37
remkor CreditAttribution: remkor commentedComment #38
DamienMcKennaThanks for your contribution, Abdoulaye!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #39
asiby CreditAttribution: asiby as a volunteer and commentedThanks a lot. I am proud to part of the Drupal community. I will do all the readings that you have suggested. I will also revisit the standards about version numbers before setup a first release for this module.
Comment #40
bapi_22 CreditAttribution: bapi_22 as a volunteer and at Cybage Software Pvt Ltd. commentedHi Asiby,
Thank you for your contribution to Drupal.
For creating a content type in a module, the best practice is to implements hook_node_info().
after that your field instances should be attached to the content type in the .install file.
Any suggestions ??
Comment #41
asiby CreditAttribution: asiby as a volunteer and commentedComment #42
asiby CreditAttribution: asiby as a volunteer and commentedNoted, thanks Bapi. Can you please report it at https://www.drupal.org/project/issues/2653566. The module status is now "Fixed" so we can move all the subsequent conversations to the module's issue queue, shall we?
I will definitely make a modification to implement Drupal's API properly. I had found the code in hook_install a little verbose. This will help making it shorter and cleaner. Thanks for the suggestion.
Comment #43
bapi_22 CreditAttribution: bapi_22 as a volunteer and at Cybage Software Pvt Ltd. commentedThank you Asiby for following the coding standard of Drupal.
Good Suggestion, I am going to add it in the issue queue.
Thanks,