You are here

function _nodeformcols_get_node_type_form in Node form columns 7

@file Contains the admin functions for Node form columns

1 call to _nodeformcols_get_node_type_form()
nodeformcols_update_placements in ./nodeformcols.admin.inc

File

./nodeformcols.admin.inc, line 8
Contains the admin functions for Node form columns

Code

function _nodeformcols_get_node_type_form($type) {
  module_load_include('inc', 'node', 'node.pages');
  global $user;
  $node = new stdClass();
  $node->uid = $user->uid;
  $node->name = isset($user->name) ? $user->name : '';
  $node->type = $type;
  $node->language = '';
  $nfid = $type . '_node_form';
  $fs = array(
    'build_info' => array(
      'args' => array(
        $node,
      ),
    ),
    'input' => array(),
  );
  $fs += form_state_defaults();
  $nf = drupal_retrieve_form($nfid, $fs);

  // Add in field_groups if they exist.
  if (module_exists('field_group') && !empty($nf['#groups'])) {
    foreach ($nf['#groups'] as $group) {
      $group_title = $group->label . ' (' . t('Field group') . ')';
      $nf[$group->group_name] = array(
        '#group' => $group,
        '#weight' => $group->weight,
        '#title' => $group_title,
      );
      foreach ($nf['#groups'][$group->group_name]->children as $group_field) {
        unset($nf[$group_field]);
      }
    }
  }
  drupal_prepare_form($nfid, $nf, $fs);
  drupal_process_form($nfid, $nf, $fs);
  return $nf;
}