This module is Inspired by the NodeReference URL widget, but far simpler. This module will create links in the same style on nodes for Entity Reference fields that are configured with Entity Reference prepopulate.

Rationale: It is unclear what the future holds for the Reference module. Entity Reference is more generic in nature, but lacks some of the functionality that came with fields like Node Reference. Namely NodeReference URL. The Entity Reference prepopulate module handles the form display, while this module handles the creation of the links.

Requires Entity Reference prepopulate.

Project Page: http://drupal.org/sandbox/hazah/1488826
Repository: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/hazah/1488826.git prepopulate_create_node_links
PARview: http://pareview.sh/pareview/httpgitdrupalorgsandboxhazah1488826git

Drupal version: 7

Comments

D4Ko’s picture

Status: Needs review » Needs work

You are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
(At least this has to be done before switching back to needs review)

while waiting for an in-depht review of your module you can start out fixing some coding style issues detected by automated tools:
http://ventral.org/pareview/httpgitdrupalorgsandboxhazah1488826git

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

hazah’s picture

Status: Needs work » Needs review

My mistake for missing that. The 7.x-1.x branch is now active. I have gotten the code to report only 4 messages that I'm not clear if I need to fix or not.

Files must end in a single new line character
-- The newline is in the file, I'm not sure what to do, if anything.

If the line declaring an array spans longer than 80 characters, each element should be broken into its own line
-- This single element array is part of a function call to t(), does it need to actually be split?

The other two are conditions that overstep 80 by no more than 4 chars. I think these are ok.

The module was confirmed to behave as expected after all the changes were made.

hazah’s picture

Checking in. Is there any actual issue with the code at this point. Any reason for this application to see further delayes from becoming an official project?

Some people are already using this module because it solves a generic use case. It is my wish for them to be able to have official update/upgrade notifications like all other modules.

Thank you.

geertvd’s picture

Status: Needs review » Reviewed & tested by the community

You're getting a warning sometimes ('Warning: Invalid argument supplied for foreach() in form_type_checkboxes_value()')
Check if your $options array is not empty before adding the checkboxes field.

When no target bundles are selected, You don't give any Contant types available (entityreference say's 'Optional, leave empty for all bundles.' so all content types should be available).

Also you still have some coding style issues (not the ones you mentioned in #2):
http://ventral.org/pareview/httpgitdrupalorgsandboxhazah1488826git
Although I see that you're just following views's example with the class names so that's probably not an issue.

Besides that it seems to be working for me.

geertvd’s picture

Status: Reviewed & tested by the community » Needs work
hazah’s picture

Status: Needs work » Needs review

I found and fixed the warning and changed the default to reflect the field's documentation.

You are correct in that I had used view's own classes as templates for my code, hence that is the style they're written in. All other code had been carefully modified to reflect guidelines as closely as possible. I do hope it's not an issue in those special cases.

hazah’s picture

Assigned: Unassigned » hazah
Status: Needs review » Needs work

Definately needs more work at this time.

hazah’s picture

Status: Needs work » Postponed

I need to postpone this as time simply isn't allowing me to resolve the last few issues.

hazah’s picture

Status: Postponed » Needs review

The last number of issues have been resolved to the best of my ability. This project is now ready for another review to become a full fledged module.

hazah’s picture

Anyone care to review?

caseyc’s picture

I see you've been waiting for over a month. As you can see there's a long backlog of modules waiting for review. You can move to the front of the line by helping to review other modules. For more information: http://drupal.org/node/1410826

You created a 7.x branch but you still need to delete the master branch. Here's how (steps 6 & 7): http://drupal.org/node/1127732

In PrepopulateCreateNodeLinksInstanceBehavior.class.php, you commented out lines 13-16 using Perl style comments (#). You should use php style comments instead (//).

In views_handler_field_prepopulate_create_node_links.inc, you need to rename your class and function. Drupal prefers UpperCamel capitalization for classes, lowerCamel for functions, and no underscore for spaces. So your class should be ViewsHandlerFieldPrepopulateCreateNodeLinks, and your function should be renderLink.

You should also run your module through the automated tester: http://ventral.org/pareview

hazah’s picture

Thank you for the input. I'll get rid of the master branch and fix up the comment style. As for the views class, it's a direct copy & modification of a class found in the views module. It follows views conventions. This is to keep things lined up as much as possible. That is, all code dealing with views looks the same weather I'm looking at my module or the views module. This is the only exception in my code and is directly influenced by the need to keep things clear.

frankye’s picture

Status: Needs review » Needs work

Hello hazah,
Your project I like, but I have to comment code in files PrepopulateCreateNodeLinksInstanceBehavior.class.php, prepopulate_create_node_links.module and use function t() width variables.

For example: PrepopulateCreateNodeLinksInstanceBehavior.class.php (line 26) you can use:
$options[$content_type] = t('@content_type', array('@content_type' => node_type_get_name($content_type)));
by example forum_menu_local_tasks_alter in Drupal API Documentation.

prepopulate_create_node_links.module in line 103 and 107 you can use:

$links[$type_name . '_' . $field_name] = array(
          'title' => t('Add new @content_type', array('@content_type' => $target_content_type)), // Correct Documentation for f()
          'href' => format_string('node/add/!content_type', $target_content_type_link),
          'query' => array($field_name => $node->nid) + drupal_get_destination(),
          'attributes' => array(
            'title' => t('Add new @content_type', array('@content_type' => $target_content_type)), // Correct Documentation for f()
          ),
        );

By documentation in site http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/t/7

klausi’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

If you reopen this please keep in mind that we are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)

hazah’s picture

No prob. Thanks for showing me the way forward :).

hazah’s picture

Issue summary: View changes

Indicated drupal version.

mlncn’s picture

Issue summary: View changes
Status: Closed (won't fix) » Needs work

The module works and it's a needed addition and should be a full project. Can you make frankye's second suggested change (the first one in the plugin can drop the usage of t() entirely), or add me as a co-maintainer, hazah, and i'll make the change? If you make or accept the final minor changes needed by your module, you should definitely be made a project maintainer.

hazah’s picture

@mlncn, I'll add you as a co-maintainer. I am swamped.

heddn’s picture

Title: Prepopulate Create Node Links » Prepopulate Create Node Links [D7]
Issue summary: View changes
heddn’s picture

Automated Review

Best practice issues identified by pareview.sh / drupalcs / coder. http://pareview.sh/pareview/httpgitdrupalorgsandboxhazah1488826git

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and fragmentation.
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
Place code review here using this format:
  • (*) Warning: Invalid argument supplied for foreach() in PrepopulateCreateNodeLinksInstanceBehavior->settingsForm() (line 30 of sites/all/modules/prepopulate_create_node_links/plugins/behavior/PrepopulateCreateNodeLinksInstanceBehavior.class.php).
  • Minor finding
  • (+) Views integration is not documented and I couldn't figure out how to use it.
  • (+) Debugging code should be removed.
    class PrepopulateCreateNodeLinksInstanceBehavior extends EntityReference_BehaviorHandler_Abstract {
    
      /**
       * Generate a settings form for this handler.
       */
      public function settingsForm($field, $instance) {
    #    echo '<pre>';
    #    print_r($instance);
    #    echo '</pre>';
    #    die;
  • I'm going to disagree with the t() feedback in #1488878-13: Prepopulate Create Node Links [D7]. If you want the content type label translatable, the only solution is what is documented. Never *only* pass variable arguments into t(), instead use check_plain directly on it. What is happening is on line 26 appropriate.

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

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

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.