You are here

function nodehierarchy_views_nodehierarchy_node_form in Node Hierarchy 6.3

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

File

nodehierarchy_views/nodehierarchy_views.module, line 76
Embed a view of children onto a node.

Code

function nodehierarchy_views_nodehierarchy_node_form($node) {
  $form = array();
  $default_value = NULL;
  if (!empty($node->nh_children_view)) {
    $display = !empty($node->nh_children_view_display) ? $node->nh_children_view_display : 'default';
    $default_value = $node->nh_children_view . ':' . $display;
  }
  if ($node && nodehierarchy_node_can_be_parent($node)) {
    $form['nh_children_view'] = array(
      '#type' => user_access('edit embedded child view') ? 'select' : 'value',
      '#title' => t('Embed Children View'),
      '#multiple' => FALSE,
      '#options' => _nodehierarchy_views_view_options(),
      '#required' => FALSE,
      '#default_value' => $default_value,
      '#description' => t("Embed a view containing this node's children into the node's page view"),
    );
  }
  return $form;
}