function nodeformcols_configuration_form in Node form columns 7
1 string reference to 'nodeformcols_configuration_form'
- nodeformcols_menu in ./
nodeformcols.module - Implementation of hook_menu().
File
- ./
nodeformcols.admin.inc, line 124 - Contains the admin functions for Node form columns
Code
function nodeformcols_configuration_form($form, $form_state, $node_type, $variant = 'default') {
$type = $node_type->type;
$variants = array();
drupal_alter('nodeformcols_variants', $variants, $type);
$form = array();
if (!empty($variants)) {
$variant_links = array(
'default' => array(
'title' => t('Default'),
'href' => 'admin/structure/types/manage/' . $type . '/form',
),
);
foreach ($variants as $id => $title) {
$variant_links[] = array(
'title' => $title,
'href' => 'admin/structure/types/manage/' . $type . '/form/' . $id,
);
}
$form['variant'] = array(
'#type' => 'item',
'#title' => t('Select a form variant'),
'#markup' => theme('links', array(
'links' => $variant_links,
)),
);
}
if (empty($variant)) {
$variant = 'default';
}
$form['#variant'] = $variant;
$placements = nodeformscols_field_placements($type, $variant);
nodeformcols_update_placements($type, $variant, $placements);
$regions = nodeformcols_form_regions();
$form['type'] = array(
'#type' => 'value',
'#value' => $type,
);
$form['#after_build'][] = '_nodeformcols_configuration_form_after_build';
$form['conf'] = array(
'#theme' => array(
'nodeformcols_configuration',
),
);
foreach ($placements as $name => $info) {
$key = 'field_' . $name;
$weight = isset($info['weight']) ? $info['weight'] : 0;
$form['conf'][$info['region']][$key] = array(
'#weight' => $weight,
$key . '_name' => array(
'#markup' => !empty($info['title']) ? $info['title'] : $name,
),
$key . '_region' => array(
'#type' => 'select',
'#options' => $regions,
'#default_value' => $info['region'],
'#attributes' => array(
'class' => array(
'field-region-select field-region-' . $info['region'],
),
),
),
$key . '_weight' => array(
'#type' => 'textfield',
'#default_value' => $weight,
'#size' => 3,
'#attributes' => array(
'class' => array(
'field-weight field-weight-' . $info['region'],
),
),
),
);
if (!$info['has_required']) {
$form['conf'][$info['region']][$key][$key . '_hidden'] = array(
'#type' => 'checkbox',
'#title' => t('Hide'),
'#default_value' => isset($info['hidden']) ? $info['hidden'] : FALSE,
);
}
if (isset($info['collapsed'])) {
$form['conf'][$info['region']][$key][$key . '_collapsed'] = array(
'#type' => 'checkbox',
'#title' => t('Show collapsed'),
'#default_value' => isset($info['collapsed']) ? $info['collapsed'] : FALSE,
);
}
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}