function pretty_calendar_block_configure in Pretty Calendar 7
Implements hook_block_configure().
File
- ./
pretty_calendar.module, line 94 - Simple nice calendar module that displays the materials by date.
Code
function pretty_calendar_block_configure($delta = '') {
$form['pretty_calendar_page_title'] = array(
'#type' => 'textfield',
'#size' => 128,
'#maxlength' => 128,
'#title' => t('Calendar page title'),
'#default_value' => variable_get('pretty_calendar_page_title', t('Activities calendar')),
'#description' => t('Choose a title for page that will display all calendar nodes.'),
);
$node_types = node_type_get_types();
$node_type_options = array();
$node_type_options[''] = t('All node types');
foreach ($node_types as $node_type) {
$node_type_options[$node_type->type] = $node_type->name;
}
// Search themes.
$themes = array();
$theme_path = drupal_get_path('module', 'pretty_calendar') . '/themes/';
if ($handle = opendir($theme_path)) {
// Check for directory, calendar.css.
while (FALSE !== ($dir = readdir($handle))) {
if (is_dir($theme_path . $dir) && file_exists($theme_path . $dir . '/calendar.css')) {
$themes[$dir] = $dir;
}
}
closedir($handle);
}
$form['pretty_calendar_theme'] = array(
'#type' => 'select',
'#options' => $themes,
'#title' => t('Theme'),
'#default_value' => variable_get('pretty_calendar_theme', 'round'),
'#description' => t('Select calendar appearance.'),
);
$form['pretty_calendar_node_type'] = array(
'#type' => 'checkboxes',
'#options' => $node_type_options,
'#multiple' => TRUE,
'#title' => t('Node type'),
'#default_value' => explode(',', variable_get('pretty_calendar_node_type', '')),
'#description' => t('Select node type.'),
);
$form['pretty_calendar_node_invert'] = array(
'#type' => 'checkbox',
'#title' => t('Invert selection.'),
'#default_value' => variable_get('pretty_calendar_node_invert', FALSE),
);
// Search date fields.
$fields = field_info_fields();
$fields_options[''] = t('Node creation date');
$date_module = module_exists('date');
if ($date_module) {
$field_desc = t('Select field that contains the date of the event. By default, nodes will be selected by date of creation.');
foreach ($fields as $field_type => $field_data) {
if ($field_data['module'] == 'date') {
$fields_options[$field_type] = $field_type;
}
}
if (count($fields_options) == 1) {
$field_desc = '<span style="color:red; font-weight:bold;">' . t('There are no date fields') . '</span>';
}
}
else {
$field_desc = '<span style="color:red; font-weight:bold;">' . t('<a href="http://drupal.org/project/date" target="_blank">Date</a> module is not installed') . '</span>';
}
$form['pretty_calendar_field_date'] = array(
'#type' => 'select',
'#options' => $fields_options,
'#disabled' => !$date_module,
'#title' => t('Date field'),
'#default_value' => variable_get('pretty_calendar_field_date', ''),
'#description' => $field_desc,
);
$form['pretty_calendar_title_words'] = array(
'#type' => 'textfield',
'#size' => 64,
'#maxlength' => 64,
'#title' => t('Event headings'),
'#default_value' => variable_get('pretty_calendar_title_words', t('story,stories')),
'#description' => t('Choose a name for the events that will be displayed in the calendar when mouse hover on date. For example, "12 events". Enter a comma-separated words for numbers (for example, "event, events").'),
);
$form['pretty_calendar_node_per_page'] = array(
'#type' => 'select',
'#options' => drupal_map_assoc(array(
5,
10,
15,
20,
25,
30,
40,
50,
80,
100,
)),
'#title' => t('Number of nodes per page'),
'#default_value' => variable_get('pretty_calendar_node_per_page', '20'),
);
$form['pretty_calendar_preload_tooltips'] = array(
'#type' => 'radios',
'#options' => array(
'+' => t('Display links to nodes by day.'),
'-' => t('Display the amount of nodes by day.'),
),
'#title' => t('Tooltip type'),
'#default_value' => variable_get('pretty_calendar_preload_tooltips', '-'),
);
$form['pretty_calendar_tooltip_count'] = array(
'#type' => 'select',
'#options' => drupal_map_assoc(array(
1,
2,
3,
4,
5,
8,
10,
15,
20,
)),
'#title' => t('Number of links in the tooltip'),
'#default_value' => variable_get('pretty_calendar_tooltip_count', '5'),
'#description' => t('Specify the number of links in the tooltip (if links display selected for tooltip display type).'),
);
$form['pretty_calendar_separate_languages'] = array(
'#type' => 'checkbox',
'#title' => t('Separate nodes by language'),
'#default_value' => variable_get('pretty_calendar_separate_languages', FALSE),
'#description' => t('If checked nodes will be selected in the language in which they were created.'),
);
return $form;
}