Pagemanager path aliases allows you to set aliases for your page directly from the pagemanager configuration.

This module can be used in the following scenario:

- You create a new page with path /faq.
- You want to add this page to the menu in different places.
- You add the page under Contact and under About us.
- When you go to Contact and then to faq you will see that the active trail is not correct.
- This is because the menu system of drupal takes the first occurence of a menu item with the path /faq.

This module provides you to enter multiple aliases for your page. Then you can change the path of faq under contact to one of your aliases.
Now the active trail will be correct!

Exportability
The aliases are saved along with the page, which means that if you export the page through a Feature, the aliases you've set will also have been exported.

SANDBOX: https://drupal.org/sandbox/sandergo90/2221921
GIT: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/sandergo90/2221921.git page_manager_path_aliases

Reviews of other projects:
https://drupal.org/node/2207873#comment-8594087
https://drupal.org/node/2220943#comment-8594001
https://drupal.org/node/2116769#comment-8594143

CommentFileSizeAuthor
#17 pareview_results.txt1.48 KBmpdonadio
#5 Selection_009.png94.23 KBalinouman

Comments

PA robot’s picture

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.

j.branson’s picture

The automated review checks out cleanly! (http://pareview.sh/pareview/httpgitdrupalorgsandboxsandergo902221921git) So does my manual test. This module is useful! But I think you could add more details to the description field about trailing and leading slashes. It's unclear if you are supposed to include them and it would be a nice consistency with other path declaration forms.

Also, it's a small detail but you may want to consider adding a space in the module name and everywhere else it appears so that it's 'page manager path alias' to match the 'page manager' syntax which is two words. The two words keeps things consistent.

I'm leaving this on needs review for a second set of eyes to look at it and perhaps for you to tweak those small details, but otherwise nice job!

sandergo90’s picture

Hi,

Thank you for the excellent review! I've adapted the name of the module and added some more information for the slashes.

if you have any other idea for the description for the slashes, please let me know!

Thanks!

alinouman’s picture

Status: Needs review » Needs work

1-I have been constantly getting warning (screen shot attached), may be you have to use isset on line 15
2-change git link to now git clone --branch 7.x-1.x http://git.drupal.org/sandbox/sandergo90/2221921.git page_manager_path_aliases

alinouman’s picture

StatusFileSize
new94.23 KB
sandergo90’s picture

Issue summary: View changes
sandergo90’s picture

Status: Needs work » Needs review

I've adapted the code to check if the subtask is set.

I've also changed the submit function. Before I flushed the menu_router with menu_router_rebuild(). This was not correct so now I am using " variable_set('menu_rebuild_needed', TRUE);". This is a much better solutions and now everything works excellent.

dahousecat’s picture

Status: Needs review » Needs work

Usability Review

I'm not very familiar with page manager or panels, but I did my best to try and use this module.
I followed the example in your readme and created a contact page, an about us page and an faq page. After placing faq under both contact and about us in the menu I could see that the active trail showed both faq pages as active.
I then went to page manager and added a custom page for my faq page. I tried added the page path as /faq but that resulted in an error so I went with /node/52. The Variant type field was a bit confusing as I didn't want to create a panel or an HTTP response code, I just wanted a second url alias, but went for panel.
I then went to the Path aliases panel and set my aliases as faq, faq1 and faq2 and clicked update. This resulted in the following errors:

Notice: Undefined property: stdClass::$src in page_manager_path_aliases_settings_form_validate() (line 139 of /var/www/test/htdocs/sites/all/modules/page_manager_path_aliases/page_manager_path_aliases.module).
That path is currently assigned to be an alias for . This system cannot override existing aliases.
Warning: explode() expects parameter 2 to be string, object given in page_manager_page_get_named_arguments() (line 500 of /var/www/test/htdocs/sites/all/modules/ctools/page_manager/plugins/tasks/page.inc).
Warning: Invalid argument supplied for foreach() in page_manager_page_get_named_arguments() (line 501 of /var/www/test/htdocs/sites/all/modules/ctools/page_manager/plugins/tasks/page.inc).

Once of these is generated by your module, but the notice and warning's should be fixed.

After removing faq from the list the errors disappeared and I could save my changes.

At this point neither faq1 or faq2 actually pointed to my faq page, however I think this could just be down to my incompetence with the page manager and panels modules (it seems much easier to achieve everything they do though code than using their UI!)

Code Review

All looks good apart from:

  • page_manager_path_aliases.module ln 63 - I don't think there should be an ampersand then a space before $form_state.
sandergo90’s picture

Status: Needs work » Needs review

Hello,

Thanks for the review! I've adapted the code for resolving the errors.

Actually the way you did it, is not the way that this module can work.

You have to create a new panel page and fill in the path for this panel page. On this page you can add some content in the "content" tab.

When you did this you add some aliases with my module. This way your panel page will have multiple paths.

dahousecat’s picture

Status: Needs review » Reviewed & tested by the community

Hi Sander,

Thanks for the explanation of how to use panels - was getting rather confused before!

I've now managed to create a panel page, add some content to it, and create multiple aliases for the same page. I then added each alias to different menu items and the correct trail was shown on each of them so the module is doing what it says it's meant to.

I tried to recreate the errors that I came across before and can confirm these are fixed.

I was able to add existing paths an a path alias, however this had no effect on that page. For example I added added "node/3" and didn't receive a warning, but also had no effect so I can't really see this being an issue.

There is 1 pareview error: page_manager_path_aliases.info - 7 | ERROR | Files must end in a single new line character.

And in page_manager_path_aliases.module one line 171 - should not be an ampersand before $form_state.

These are both minor issues so I'm happy to give RTBC status.

sandergo90’s picture

Thanks for the RTBC status!

I've adapted the code changed you asked for so pareview will now go correctly!

Thanks!

heddn’s picture

Status: Reviewed & tested by the community » Needs work

.info:
I'm not sure this actually does depend upon panels.

.module:
Don't use extra whitespace in a call to t(). This makes it difficult for translation. One long line is sufficient.

    '#description' => t("Enter one path per line. The path can't start with
     a leading slash or end with a trailing slash. You cannot have a dynamic
     path element after an optional path element. The first element in a path
     may not be dynamic. You cannot have a static path element after an optional
     path element."),

Alias validation doesn't account for language. See path_form_element_validate for an example. Why don't you use drupal_lookup_path?

Menu validation should be able to use drupal_valid_path?

Moving to needs work for the translation piece and the alias validation. The rest is highly encouraged though.

sandergo90’s picture

Status: Needs work » Needs review

Thanks for the feedback.

1. Info: Panels is indeed not needed but I think the people who would use this module, will also use panels. But I will delete it out of the info file.
2. Module: Fixed, everything now on one line.
3. I've added the validation with drupal_lookup_path. The menu validation is being used from page_manager itself as all the rest of the validation. I think that's also the way it should be.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

Moving to RTBC and waiting for another git administrator to give this a second set of eyes.

mpdonadio’s picture

Assigned: Unassigned » mpdonadio

Assigning to myself for the second look when I can get to it. @heddn, feel free to assign to me for this in the future.

mpdonadio’s picture

Automated Review

Review of the 7.x-1.x branch:

  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards). See attachment.
  • DrupalPractice has found some issues with your code, but could be false positives, and may be duplicate results from Coder Sniffer. See attachment.

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

Minor, btu fix when you can.

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No multiple applications
Yes
No duplication
Yes
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements
3rd party code
Yes: Follows the guidelines for 3rd party code.
README.txt
Yes: Follows the guidelines for in-project documentation and the README.txt Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes. If "no", list security issues identified.
Coding style & Drupal API usage

So, this works by duplicating the router item for each alias? Why can't you use the Path API? Wouldn't this mean
that globalredirect wouldn't work for these aliases? This needs some commenting / documenting, as it looks like
these are cloned menu items and not path aliases. After reading the code, I think I get the issues, but it should
be made clear. If these really are cloned menu items, you may want to rethink the module name, as calling them
path aliases would be a little misleading.

You may want a permission to be able to set the path aliases.

What happens when you enable a disabled page that has aliases, and you have overlap?

The db_query() in page_manager_path_aliases_settings_form_validate() can be simplified as it looks like you
are only using one column. It may also be better to use menu_get_item() instead of the query, in case the menu
needs to be rebuilt (and, in general, it is preferable to program against the API and not the implementation whenever possible).

Will this work on panel variants, or just at the panel page level (my test site doesn't have any panel pages on it right now)?

I think calling menu_rebuild() instead of the variable set may be a better option.

I think this needs a little polishing before a proper release, but I am not seeing any blocking issues.

Please don't remove the security tag, we keep that for statistics and to show examples of security problems.

mpdonadio’s picture

Assigned: mpdonadio » Unassigned
Status: Reviewed & tested by the community » Fixed
StatusFileSize
new1.48 KB

Here is the missing attachment.

Thanks for your contribution, sandergo90!

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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.