CVS edit link for jrao

Hi,

I'd like to contribute a Hierarchical Select Node Reference module which uses HS (http://drupal.org/project/hierarchical_select) as CCK node reference widget. My preliminary work can be seen at http://drupal.org/node/257922#comment-2214266, the maintainer of HS suggests I publish it as a separate module per http://drupal.org/node/257922#comment-2220822

Thanks

CommentFileSizeAuthor
#4 hs_nodereference.zip17.58 KBjrao
#1 hs_nodereference.zip16.62 KBjrao

Comments

jrao’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new16.62 KB
avpaderno’s picture

Status: Needs review » Needs work
    if($field === FALSE) return array();
    // No more children if we're in the last level
    if($field['type_name'] == $last_type_name && $field['field_name'] == $last_field_name) 
      return array(); 
    $next_field = _hs_nodereference_get_next_field_from_path($params['nodereference_path'], $field);
    if($next_field === FALSE) return array();

See the Drupal coding standards to understand how a module code should be written.
See also what reported about the respect of the namespace, in the coding standards.

avpaderno’s picture

  if($params['nodereference_path'] === FALSE) {

The coding standards report that there should be a space after the if, and before the parenthesis.

jrao’s picture

Status: Needs work » Needs review
StatusFileSize
new17.58 KB

Ok, code style cleaned up, but I'm not sure about the problem with namespace though, could you clarify? Thanks

avpaderno’s picture

Status: Needs review » Fixed
  1.   $items['admin/content/node-type/%/fields/%/hs_config'] = array(
        'title'            => t('Hierarchical Select Configuration'),
        'access arguments' => array('administer site configuration'),
    

    Menu callback titles, and description should not be passed to t() because that is already done by Drupal core code.

  2.   $field_name = $field['field_name'];
      require_once(drupal_get_path('module', 'hierarchical_select') .'/includes/common.inc');
    

    The code could use module_load_include().

  3.     return hs_nodereference_hierarchical_select_children(
          $parent, $params);    
    

    The code could be written in a single line, as the line length would not be greater than 80.

  4.     $field = _hs_nodereference_get_field_from_path($params['nodereference_path'], $node);
        if ($field === FALSE) {
          return array();
        }
    

    If 0, and FALSE are not both two possible return values of the function, then the IF-statement could be re-written as if (!$field) {.

  5.     $form['hierarchical_select_config']['save_lineage']['#description'] .= '<br />'
         . t('This setting is disabled because the number of values in this field 
         \'!number-of-values\' is less than the number of levels \'!number-of-levels\'.',
    

    When possible, avoid to escape the string delimiter inside strings, especially if they are translated; when the string delimiter is used inside the string, it is enough to use the other string delimiter to delimit the string.
    In a HTML string, it is possible to use the tag <q> to avoid to use the apices inside a string.

Status: Fixed » Closed (fixed)

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

avpaderno’s picture

Component: Miscellaneous » new project application
Assigned: Unassigned » avpaderno
Issue summary: View changes
Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

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