You are here

function nodehierarchy_widgets_nodehierarchy_get_parent_selector in Node Hierarchy 6.3

Same name and namespace in other branches
  1. 6.2 nodehierarchy_widgets/nodehierarchy_widgets.module \nodehierarchy_widgets_nodehierarchy_get_parent_selector()
  2. 7.4 nodehierarchy_widgets/nodehierarchy_widgets.module \nodehierarchy_widgets_nodehierarchy_get_parent_selector()
  3. 7.2 nodehierarchy_widgets/nodehierarchy_widgets.module \nodehierarchy_widgets_nodehierarchy_get_parent_selector()

Implementation of hook_nodehierarchy_get_parent_selector().

File

nodehierarchy_widgets/nodehierarchy_widgets.module, line 27
Alternative parent selector widgets for Node Hierarchy.

Code

function nodehierarchy_widgets_nodehierarchy_get_parent_selector($child_type, $pnid, $exclude = NULL) {
  if (variable_get('nodehierarchy_widgets_parent_selector', 'autocomplete') == 'autocomplete') {
    drupal_add_css(drupal_get_path('module', 'nodehierarchy_widgets') . '/nodehierarchy_widgets.css');
    $out = array(
      '#type' => 'textfield',
      '#autocomplete_path' => 'nodehierarchy/autocomplete/parent/' . $child_type . '/' . $exclude,
      '#child_type' => $child_type,
      '#exclude' => $exclude,
      '#description' => 'Enter the title of the parent node.',
      '#element_validate' => array(
        '_nodehierarchy_widgets_autocomplete_parent_validate',
      ),
      '#default_value' => _nodehierarchy_widgets_autocomplete_parent_value($pnid),
    );
    return array(
      $out,
    );
  }
}