Description

Node collection (previously names as Entity Collection(Super Node)) is a module that will allow you to add parent child relationships on different content types and will help you to create content rich small microsites inside your Drupal 7 installation . Once you define a parent-child relationship and if you create a parent node, the module will add admin links to create or edit child nodes and vice versa. Therefore you can have a collection of node instances bound together as a collection on a parent child relationship and will make it very easy for a content editor to manage the relationship instances. Once you have created the parent node and the child nodes associated with it using the admin links on the bottom of each parent or child content type edit/create screens you will have the following set of features/abilities enabled per relationship instance basis.

  • A menu item will be created automatically to link up the parent and the children together for each relationship instance (parent-child node collection).
  • The menu generated will be rendered on theme $title_prefix horizontally so that it will provide you with a small browsable microsite on you visit any of the parent or child node instance.
  • Relative path for the children will be automatically generated (If the parent path is http://example.com/parent the child path will be http://example.com/parent/child).
  • Template suggestions will be added based on the relationship so that you can theme the collection differently regardless of the content type individually (Please see below or read the README file in the module for more documentation).
  • The parent node object will be accessible to any child node object in the theme layer. Therefore you can add more logic onto it based on the relationship.
  • Set of API functions which will allow a developer to use the relationship data elsewhere in the site.

Project, Repo and Version details

Project page: http://drupal.org/sandbox/sankatha/1493998
Git clone: git clone --branch 7.x-1.x sankatha@git.drupal.org:sandbox/sankatha/1493998.git
Version: Drupal 7

Reviews of other projects

Comments

patrickd’s picture

welcome,

Please rename your readme to "README.txt"

Great, you've already cleaned up all styling stuff reported by automated reviews :)

Putting the module in the category/package called "Maya" doesn't make much sense for me ?

You can also get a review bonus and we will come back to your application sooner.

regards

sankatha’s picture

Hi Patrick. Thank you very much for looking into this module. I have renamed the readme.txt to README.txt and also have removed the package information from the info file so it can go into OTHER. I have written this module for one of my clients and Maya was actually a project code name :D and sorry for leaving it over. I am very much looking forward to review some of the modules. Thanks again - San

logaritmisk’s picture

The name entity_collection is already taken (http://drupal.org/project/entity_collection)

logaritmisk’s picture

Status: Needs review » Needs work

Forgot to change status. I guess you need to find a new name :/

logaritmisk’s picture

Issue summary: View changes

Changes a sentence so that it makes more sense.

sankatha’s picture

Title: Entity Collection (Super Node) » Node Collection (Previously known as Entity Collection (Super Node))

Hi Guys. Thank you very much for your help and reviews. I have renamed the project to Node Collection (Had a look around and cant find any by that name :) though).

sankatha’s picture

Status: Needs work » Needs review
sankatha’s picture

Issue summary: View changes

Change the body so that it reflects the new name.

sankatha’s picture

Issue tags: +PAreview: review bonus

Adding the "PAReview: review bonus" Tag

itsekhmistro’s picture

One issue found: There are still files other than README.txt in the master branch.
Please remove all files except README.txt from master branch.
Rename `readme.txt` into `README.txt`.

Code is verified with Drupal Code Sniffer. All is ok.

Installed and tested on fresh Drupal installation. Works fine.

sankatha’s picture

Thanks for the review Ivan. I have removed everything from the Master branch except the README.txt.

itsekhmistro’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine. ( please, also remove empty API/ folder from master branch)

sankatha’s picture

Hi Ivan. Thanks again. Seems like the API folder is not there :( (http://drupalcode.org/sandbox/sankatha/1493998.git/tree/refs/heads/master).

itsekhmistro’s picture

Priority: Normal » Major

Yes, it's ok.

itsekhmistro’s picture

Issue summary: View changes

Added Reviews of other projects section to the issue summery

patrickd’s picture

Issue tags: -PAreview: review bonus

Sorry, I got to remove that tag as per

You can use automated tools like pareview.sh for review but you must always do an additional manual review.

From #1410826: [META] Review bonus

Please do 3 manual reviews for getting a review bonus

sankatha’s picture

Hi Patrick. No worries. I have done manual reviews against the reports anyway but will do some more reviews to help you guys :).

sankatha’s picture

Issue summary: View changes

More to Reviews of other projects.

patrickd’s picture

We all really appreciate that :)

patrickd’s picture

Assigned: Unassigned » patrickd

me will do it

sankatha’s picture

Hi Patrick. Sorry I am not clear on your comment 'me will do it' ? :)

patrickd’s picture

Assigned: patrickd » Unassigned
Priority: Major » Normal
Status: Reviewed & tested by the community » Needs review
Issue tags: +PAreview: security

Minor stuff that catched my eye

  1. usually permission machine names are separated with whitspace not underscore (administer_node_collections -> administer_node_collections)
  2. require_once "$module_path/admin/node_collection_node_forms.admin.inc"; doing that drupal_get_dir stuff is not necessary (and looks ugly) require_once 'admin/node_collection_node_forms.admin.inc'; should just work the same
  3. Implements hook_perm().update to hook_permission
  4. The base table for node_collection_parent.This is not very helpful, describing what exactly the table is good for is a more common practice
  5.  * Implements hook_form().
     * Admin settings form for the node collections

    Please start function descriptions with a short intro (like "Implements .."); leave a blank comment line and end comments with a dot

     * Implements hook_form().
     *
     * Admin settings form for the node collections.
  6. Maybe admin/structure or admin/config/content is a better place for your module config?
  7. What about using a MENU_LOCAL_ACTION for your add relationship link ?
  8. Please use the "empty" option of tables to define a message to show instead of an header-only table (looks broken)
  9. you should really think about using shorter paths (node_collection_settings/edit_delete_node_collection_relationships could be node-collection/list)
  10. If there's a new menu for every

Security issue:
Your not filtering the relation name correctly, putting <script>alert('xss');</script> into it will cause the site to execute that js (= XSS).
Make sure to filter all your output correctly. There are several functions for that, in this case check_plain() should do the job.
Please inform your self about that. (Also have a look at the presentation about security vulnerabilities at denver)

Also the module did not work out for me really good

  • After I created several child node there was still only the overview link in the menu
  • also the automatic parent/children path generation didn't work out for me

Did I overlook something?

regards

patrickd’s picture

Status: Needs review » Needs work

.

sankatha’s picture

Hi Patrick. Thanks for the review. Just to answer the follwing

Also the module did not work out for me really good

After I created several child node there was still only the overview link in the menu
also the automatic parent/children path generation didn't work out for me
Did I overlook something?

You probably have not created the child items using the links in the vertical tabs in the menu create/edit form add should have used the Content > Add content instead which will not work.

Will fix the other issues shortly :)

Cheers
San

patrickd’s picture

Ahh, okay, I see (that link is hard to find, that's probably another good point for using a MENU_LOCAL_ACTION ;) )

sankatha’s picture

Yup Agree :). Just changing it...

sankatha’s picture

Hi Patrick

The following issues were addressed as requested.

  1. usually permission machine names are separated with whitspace not underscore (administer_node_collections -> administer_node_collections)
    Resolution: Removed the underscores and added spaces.
  2. require_once "$module_path/admin/node_collection_node_forms.admin.inc"; doing that drupal_get_dir stuff is not necessary (and looks ugly)require_once 'admin/node_collection_node_forms.admin.inc'; should just work the same
    Resolution: Cleaned up as suggested :)
  3. Implements hook_perm().update to hook_permission
    Resolution: Updated to hook_permission.
  4. The base table for node_collection_parent.This is not very helpful, describing what exactly the table is good for is a more common practice
    Resolution: Added more meaningful table descriptions.
  5. * Implements hook_form().<br> * Admin settings form for the node collections

    Please start function descriptions with a short intro (like "Implements .."); leave a blank comment line and end comments with a dot

    * Implements hook_form().<br> *<br> * Admin settings form for the node collections.


    Resolution: Fixed by adding a new line as suggested.

  6. Maybe admin/structure or admin/config/content is a better place for your module config?
    Resolution: Used admin/config/content.
  7. What about using a MENU_LOCAL_ACTION for your add relationship link ?
    Resolution: Added MENU_LOCAL_ACTION and removed the vertical tab form alter :)
  8. Please use the "empty" option of tables to define a message to show instead of an header-only table (looks broken)
    Resolution: Added the empty option to theme_table.
  9. you should really think about using shorter paths (node_collection_settings/edit_delete_node_collection_relationships could be node-collection/list)
    Resolution: Added shorter paths as suggested.
  10. If there's a new menu for every: Yes there is. I see what is your point though. The original intention of this module is to create couple of micro sites in a Drupal installation so this is not actually a problem. Will address this in the future if any issues arises.

Security issue:

Your not filtering the relation name correctly, putting &lt;script&gt;alert('xss');&lt;/script&gt; into it will cause the site to execute that js (= XSS).

Resolution: Ahhh ! Sorry I missed this in the first place :). Fixed.

Regards
San

sankatha’s picture

Status: Needs work » Needs review
sankatha’s picture

Issue summary: View changes

Removing the automated test result comments from the Reviews of other projects

sankatha’s picture

Issue summary: View changes

Added another review link

sankatha’s picture

Issue tags: +PAreview: review bonus

Adding PAReview: review bonus tag.

itsekhmistro’s picture

Status: Needs review » Needs work

Manual review,

are you sure all this includes are requried globally?

// Add the required files.
require_once 'admin/node_collection.admin.inc';
require_once 'admin/node_collection_node_forms.admin.inc';
require_once 'api/node_collection.api.inc';
require_once 'theme/node_collection.theme.inc';

forexample, I mean why not to put conditional load for admin/node_collection.admin.inc in node_collection_menu()

sankatha’s picture

Thanks for the review. node_collection.api.inc requires globally. I prefer the rest defined together as well because it makes it looks cleaner here and the code will be more readable for me. Just a personal coding style :). And the way you suggest will give you very litte or no benefit at all because these files are very small. So no offence. Just my coding style :) in this occasion. Also in Drupal coding standards it does not say anything about the style to follow http://drupal.org/coding-standards#includes as well. Hope this helps.

sankatha’s picture

Status: Needs work » Needs review
seyv’s picture

Hi sankatha,

Pretty solid module, I can't find any immediate changes I would suggest. Except:

  • In your hook_menu(): you should define your NODE_COLLECTION_SETTINGS_PATH. Currently the settings for your module appear in admin/config/content/ by adding a title, description they will group under your module name.

That's it, guess this is almost done ;)

sankatha’s picture

Hi Sey. Thanks for the review. As per Patrick's suggestions(http://drupal.org/node/1494434#comment-5813600) I have to change it to admin/config/content/. It was used to be in its own group :).

seyv’s picture

Status: Needs review » Reviewed & tested by the community

Ok, I missed part 6 of his comment ^^ Then I feel this is done ;)

sankatha’s picture

Cheers ;)

klausi’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -PAreview: review bonus

manual review:

  1. "dependencies[] = pathauto": really? why would you require that?
  2. node_collection_schema(): copy and paste error for the child nid "'description' => 'Node collection parent ID.',".
  3. node_collection.module: you are requiring a bunch a files globally here, which will be included on every single page request. Ideally you should only expose hook implementations and API functions that might be used by other modules globally.
  4. Your module file is quite small. While not an official standard it is recommended to have the important hook implementations directly in your module file, so that I can find them faster if I try to figure out where your module hooks into Drupal.
  5. node_collection_admin_settings_form(): doc block is wrong, this is not a hook. See http://drupal.org/node/1354#forms
  6. Similar for node_collection_admin_settings_form_submit().
  7. "throw new RuntimeException(...": hm, better define your own exception class to distinguish them from real PHP runtime errors?
  8. "db_insert('node_collection_parent')": better use drupal_write_record() which also validates against the DB schema. Same for you db_update() calls.
  9. node_collection_api_get_parent_node_instance(): do not use node_load() in a loop, this will be slow. Use node_load_multiple() instead.
  10. "$child_nid->ec_child_nid": the prefix "ec" still stems from the old module name and does not make sense anymore. You should probably replace it with "nc" to avoid confusion.
  11. node_collection_api_is_child_instance(): you don't need the foreach() and you should limit the query with range() if you are interested in only one record. And you can use fetchField() or similar.

Otherwise I think this is nearly ready. Good work so far! Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

sankatha’s picture

Hi klausi. Thanks for the review. Will fix these asap :)

sankatha’s picture

  1. "dependencies[] = pathauto": really? why would you require that? Resolution: Removed the dependency. You were right. I dont need it.
  2. node_collection_schema(): copy and paste error for the child nid "'description' => 'Node collection parent ID.',". Resolution: Fixed
  3. node_collection.module: you are requiring a bunch a files globally here, which will be included on every single page request. Ideally you should only expose hook implementations and API functions that might be used by other modules globally. Resolution: Kept the API file and removed all the other requires as necessary.
  4. Your module file is quite small. While not an official standard it is recommended to have the important hook implementations directly in your module file, so that I can find them faster if I try to figure out where your module hooks into Drupal. Resolution: Moved all the hook implementations to the module file.
  5. node_collection_admin_settings_form(): doc block is wrong, this is not a hook. See http://drupal.org/node/1354#forms Resolution: Fixed
  6. Similar for node_collection_admin_settings_form_submit().Resolution: Fixed
  7. "throw new RuntimeException(...": hm, better define your own exception class to distinguish them from real PHP runtime errors? Resolution: Defined the NodeCollectionRuntimeException class which extends the Exception base class and refactored the code to use that instead.
  8. "db_insert('node_collection_parent')": better use drupal_write_record() which also validates against the DB schema. Same for you db_update() calls. Resolution: Changed to use db_write_record
  9. node_collection_api_get_parent_node_instance(): do not use node_load() in a loop, this will be slow. Use node_load_multiple() instead. Resolution: I am loading only one record here. Therefore changes the query so that it uses rage and fetchField
  10. "$child_nid->ec_child_nid": the prefix "ec" still stems from the old module name and does not make sense anymore. You should probably replace it with "nc" to avoid confusion. Resolution: Changed.
  11. node_collection_api_is_child_instance(): you don't need the foreach() and you should limit the query with range() if you are interested in only one record. And you can use fetchField() or similar. Resolution: Changes as suggested.
soncco’s picture

Hello @sankatha, your module rocks :)

My simple review:

sankatha’s picture

Hey @Soncco. Thanks and thanks for pointing me out the README.txt in the master branch. Just done it ;)

soncco’s picture

Status: Needs work » Needs review

You're welcome @sankatha. I'm changing the status.

sankatha’s picture

Status: Needs review » Needs work

I am giving this module a good test. Hence changing the status to needs work.

sankatha’s picture

Status: Needs work » Needs review

Fixed and tested as suggested by @klausi.

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Sorry for the delay, but doing reviews with #1410826: [META] Review bonus is currently the only way to make this process faster.

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

  • Drupal Code Sniffer has found some issues with your code (please check the Drupal coding standards).
    FILE: ...ll/modules/pareview_temp/test_candidate/admin/node_collection.admin.inc
    --------------------------------------------------------------------------------
    FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
    --------------------------------------------------------------------------------
     118 | ERROR | Line indented incorrectly; expected 4 spaces, found 5
    --------------------------------------------------------------------------------
    

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. Get a review bonus and we will come back to your application sooner.

manual review:

  1. "php = 5.3.x": why do you need PHP 5.3? Do you use any features that are not available in 5.2?
  2. node_collection_schema(): you should specify the foreign keys that refer to the node_type and node tables.
  3. "require_once 'admin/node_collection_node_forms.admin.helper.inc';": better use something like require_once dirname(__FILE__) . '/mymodule.inc'; to avoid possible issues with relative paths. Also elsewhere.
  4. "@return void": if there is no return value just omit the @return tag. See http://drupal.org/node/1354#functions
  5. "t("Edit : $child_node->title")": do not directly embed variables into translatable strings, use placeholders instead. Also elsewhere.
  6. node_collection_api_is_parent_type(): doc block: "Return TRUE or FALSE" that is obvious from the fact that the type is boolean. You should describe in what case FALSE is returned, same for TRUE.
  7. node_collection.api.inc: all files that define classes should be listed in the info file for autoloading.
  8. node_collection_api_get_grand_parents(): why do you catch the exception if you just re-throw it? Also in node_collection_api_delete_associated_child_instance().

Although you should definitively fix those issues they are not application blockers to me, so I guess this is RTBC

sankatha’s picture

Thanks @klausi. This will be what I am working on this weekend :)

patrickd’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution and welcome to the community of project contributors on drupal.org!

I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.

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.

As you continue to work on your module, keep in mind: Commit messages - providing history and credit and Release naming conventions.

Thanks to the dedicated reviewer(s) as well.

sankatha’s picture

Thank you very much for all your help and support through out the process. Will fix the issues @klausi raised and make this module available as a release.Also will look forward to contribute more towards Drupal.

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

Anonymous’s picture

Issue summary: View changes

Another review added.