function date_tools_wizard_build in Date 6.2
Same name and namespace in other branches
- 8 date_tools/date_tools.wizard.inc \date_tools_wizard_build()
- 7.3 date_tools/date_tools.wizard.inc \date_tools_wizard_build()
- 7 date_tools/date_tools.wizard.inc \date_tools_wizard_build()
- 7.2 date_tools/date_tools.wizard.inc \date_tools_wizard_build()
1 call to date_tools_wizard_build()
- date_tools_wizard_form_submit in date_tools/
date_tools.wizard.inc
File
- date_tools/
date_tools.wizard.inc, line 141 - Date Wizard code.
Code
function date_tools_wizard_build($form_values) {
extract($form_values);
$field_name = 'field_' . $field_name;
if (!empty($repeat)) {
$widget_type .= '_repeat';
}
// Create a node type if it doesn't already exist.
// This makes it possible to add additional date fields to
// an existing type.
$types = node_get_types('names');
$type_settings = array();
if (!array_key_exists($type_name, $types)) {
date_tools_wizard_create_content_type($name, $type_name, $type_description, $type_settings);
}
else {
$types = node_get_types();
$type = $types[$type_name];
if (!empty($type_settings)) {
foreach ($type_settings as $key => $setting) {
$type->{$key} = $setting;
}
node_type_save($type);
}
$name = $type->name;
}
$field_settings = array(
'field_name' => $field_name,
'label' => $label,
'type_name' => $type_name,
'type' => $field_type,
'widget_type' => $widget_type,
'granularity' => $granularity,
'tz_handling' => $tz_handling,
'repeat' => $repeat,
'multiple' => $repeat,
);
$field_settings['widget']['label'] = $label;
$field_settings['widget']['type'] = $widget_type;
$date_field = date_tools_wizard_create_date_field($field_type, $widget_type, $tz_handling, $field_settings);
$view_name = '';
if (!empty($calendar)) {
$view_name = date_tools_wizard_create_calendar($name, $type_name, $date_field);
if (!empty($blocks)) {
date_tools_wizard_create_blocks($type_name);
}
}
return $view_name;
}