function _calendar_legend_form in Calendar 5.2
Setup Calendar legend parameters.
1 string reference to '_calendar_legend_form'
- calendar_menu in ./
calendar.module - Implementation of hook_menu().
File
- ./
calendar_admin.inc, line 465 - This file contains administrative functions used only when setting up the calendar and views_hooks() that are called infrequently and cached. No need to parse all this code the rest of the time.
Code
function _calendar_legend_form($view_name) {
$view = views_get_view($view_name);
$form = array();
$form['markup'] = array(
'#type' => 'markup',
'#value' => _calendar_settings_header($view) . t('<h3>Content Type</h3><p>Set a hex color value (like #ffffff) to use in the calendar legend for each content type. Types with empty values will have no stripe in the calendar and will not be added to the legend.</p>'),
);
//TODO Add in methods other than content types for setting legend colors.
$method = variable_get('calendar_legend_method_' . $view_name, 'types');
// TODO Move the embedded styles other than the color into a stylesheet.
$form['calendar_colorpicker'] = array(
'#type' => 'calendar_colorpicker',
'#title' => t('Legend colors'),
'#prefix' => '<div style="float:left">',
'#suffix' => '</div>',
);
$form['color'] = array(
'#tree' => TRUE,
);
$colors = variable_get('calendar_color_' . $view_name, $default_colors);
switch ($method) {
case 'types':
$color_types = node_get_types('names');
break;
}
foreach ($color_types as $key => $name) {
$form['color'][$key] = array(
'#title' => $name,
'#type' => 'calendar_colorfield',
'#default_value' => isset($colors[$key]) ? $colors[$key] : '#ffffff',
'#calendar_colorpicker' => 'calendar_colorpicker',
'#prefix' => '<div style="float:left;margin-right:10px">',
'#suffix' => '</div>',
);
}
$form['view_name'] = array(
'#type' => 'hidden',
'#value' => $view->name,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#prefix' => '<div style="clear:both;">',
'#suffix' => '</div>',
);
return $form;
}