class calendar_plugin_display_page in Calendar 7
Same name and namespace in other branches
- 6.2 includes/calendar_plugin_display_page.inc \calendar_plugin_display_page
- 7.2 includes/calendar_plugin_display_page.inc \calendar_plugin_display_page
The plugin that handles a full calendar page.
The only style option that will be available is the calendar style, which creates the navigation and links to other calendar displays. All options for paging, row plugins, etc. are deferred to the attachments.
Hierarchy
- class \views_object
- class \views_plugin
- class \views_plugin_display
- class \views_plugin_display_page
- class \calendar_plugin_display_page
- class \views_plugin_display_page
- class \views_plugin_display
- class \views_plugin
Expanded class hierarchy of calendar_plugin_display_page
1 string reference to 'calendar_plugin_display_page'
- calendar_views_plugins in includes/
calendar.views.inc - Implementation of hook_views_plugins
File
- includes/
calendar_plugin_display_page.inc, line 16 - Views page plugin for the Calendar module.
View source
class calendar_plugin_display_page extends views_plugin_display_page {
function render() {
if (!empty($this->view->date_info->forbid)) {
drupal_not_found();
exit;
}
return parent::render();
}
/**
* Display validation.
*/
function validate() {
$errors = parent::validate();
$arguments = $this->display->handler
->get_option('arguments');
if (!in_array('date_argument', array_keys($arguments))) {
if (empty($this->view->date_info->arg_missing)) {
$errors[] = t("The Calendar display '@display_title' will not work without a Date argument.", array(
'@display_title' => $this->definition['title'],
));
}
$this->view->date_info->arg_missing = TRUE;
}
elseif ($arguments['date_argument']['default_action'] != 'default' || $arguments['date_argument']['default_argument_type'] != 'date') {
if (empty($this->view->date_info->arg_missing_default)) {
$errors[] = calendar_errors('missing_argument_default');
}
$this->view->date_info->arg_missing_default = TRUE;
}
return $errors;
}
function get_style_type() {
return 'calendar';
}
function defaultable_sections($section = NULL) {
if (in_array($section, array(
'style_plugin',
'row_options',
'row_plugin',
'items_per_page',
))) {
return FALSE;
}
return parent::defaultable_sections($section);
}
/**
* Override some of the parent options.
*/
function options(&$display) {
parent::options($display);
$display['displays'] = array();
$display['style_plugin'] = 'calendar_nav';
$display['items_per_page'] = 0;
$display['row_plugin'] = '';
$display['defaults']['style_plugin'] = FALSE;
$display['defaults']['style_options'] = FALSE;
$display['defaults']['row_plugin'] = FALSE;
$display['defaults']['row_options'] = FALSE;
$display['defaults']['items_per_page'] = FALSE;
}
/**
* Add custom option definitions.
*/
function option_definition() {
$options = parent::option_definition();
$options['calendar_colors'] = array(
'default' => array(),
);
$options['calendar_colors_vocabulary'] = array(
'default' => array(),
);
$options['calendar_colors_taxonomy'] = array(
'default' => array(),
);
$options['calendar_colors_group'] = array(
'default' => array(),
);
$options['calendar_popup'] = array(
'default' => 0,
);
$options['calendar_date_link'] = array(
'default' => '',
);
return $options;
}
/**
* Provide the summary for attachment options in the views UI.
*
* This output is returned as an array.
*/
function options_summary(&$categories, &$options) {
// It is very important to call the parent function here:
parent::options_summary($categories, $options);
$variables = array(
'module' => 'calendar',
'topic' => 'settings',
);
$categories['calendar_settings'] = array(
'title' => theme('advanced_help_topic', $variables) . t('Calendar settings'),
);
$colors = $this
->get_option('calendar_colors');
$colors_taxonomy = $this
->get_option('calendar_colors_taxonomy');
$options['calendar_colors'] = array(
'category' => 'calendar_settings',
'title' => t('Legend Content Types'),
'value' => t('Edit'),
);
$options['calendar_colors_vocabulary'] = array(
'category' => 'calendar_settings',
'title' => t('Legend Vocabularies'),
'value' => t('Edit'),
);
$options['calendar_colors_taxonomy'] = array(
'category' => 'calendar_settings',
'title' => t('Legend Terms'),
'value' => t('Edit'),
);
if (function_exists('og_all_groups_options')) {
$colors_group = $this
->get_option('calendar_colors_group');
$options['calendar_colors_group'] = array(
'category' => 'calendar_settings',
'title' => t('Legend Groups'),
'value' => t('Edit'),
);
}
$popup_options = $this
->popup_options();
$default = $this
->get_option('calendar_popup');
$options['calendar_popup'] = array(
'category' => 'calendar_settings',
'title' => t('Date changer'),
'value' => isset($default) ? $popup_options[$default] : $popup_options[0],
);
$default = $this
->get_option('calendar_date_link');
$options['calendar_date_link'] = array(
'category' => 'calendar_settings',
'title' => t('Add new date link'),
'value' => !empty($default) ? check_plain(node_type_get_name($default)) : t('None'),
);
}
function popup_options() {
return array(
0 => t('No'),
1 => t('Yes'),
);
}
/**
* @TODO Figure out how to get the colorpicker working in D7.
*/
function options_form(&$form, &$form_state) {
// It is very important to call the parent function here:
parent::options_form($form, $form_state);
switch ($form_state['section']) {
case 'calendar_popup':
$form['#title'] .= t('Date changer');
$form['calendar_popup'] = array(
'#type' => 'radios',
'#default_value' => $this
->get_option('calendar_popup'),
'#options' => $this
->popup_options(),
'#description' => t('Display a popup calendar date selector?'),
);
break;
case 'calendar_date_link':
$form['#title'] .= t('Add new date link');
$form['calendar_date_link'] = array(
'#type' => 'radios',
'#default_value' => $this
->get_option('calendar_date_link'),
'#options' => array(
'' => t('No link'),
) + node_type_get_names(),
'#description' => t('Display a link to add a new date of the specified content type. Displayed only to users with appropriate permissions.'),
);
break;
case 'calendar_colors':
$method = 'types';
// TODO Move the embedded styles other than the color into a stylesheet.
$form['#title'] .= t('Content Type Legend Colors');
$form['calendar_colors']['#tree'] = TRUE;
$form['calendar_colors']['#prefix'] = '<div class="form-item"><label>' . t('Content Type') . '</label><p>' . t('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></div>';
$colors = $this
->get_option('calendar_colors');
switch ($method) {
case 'types':
$color_types = node_type_get_names();
break;
}
foreach ($color_types as $key => $name) {
$form['calendar_colors']['color'][$key] = array(
'#title' => $name,
'#type' => 'textfield',
'#default_value' => isset($colors[$key]) ? $colors[$key] : '#ffffff',
'#size' => 7,
'#maxlength' => 7,
);
}
break;
case 'calendar_colors_vocabulary':
$taxonomies = taxonomy_get_vocabularies();
$options = array();
foreach ($taxonomies as $vid => $vocab) {
$options[$vid] = $vocab->name;
}
$colors_vocabulary = $this
->get_option('calendar_colors_vocabulary');
$form['#title'] .= t('Vocabulary Legend Types');
$form['calendar_colors_vocabulary'] = array(
'#type' => 'checkboxes',
'#default_value' => isset($colors_vocabulary) ? $colors_vocabulary : array(),
'#multiple' => TRUE,
'#options' => $options,
);
$form['calendar_colors_vocabulary']['#prefix'] = '<div class="form-item"><label>' . t('Vocabularies') . '</label>' . t('Select vocabularies to use for setting calendar legend colors by taxonomy term. This works best for vocabularies with only a limited number of possible terms.') . '</div>';
break;
case 'calendar_colors_taxonomy':
$taxonomies = (array) $this
->get_option('calendar_colors_vocabulary');
$colors_taxonomy = $this
->get_option('calendar_colors_taxonomy');
$form['#title'] .= t('Taxonomy Legend Colors');
$form['calendar_colors_taxonomy']['#prefix'] = '';
if (empty($taxonomies)) {
$form['calendar_colors_taxonomy']['#prefix'] .= '<div class="form-item warning">' . t('Please select Legend vocabularies first!') . '</div>';
}
$form['calendar_colors_taxonomy']['#prefix'] .= '<div class="form-item"><label>' . t('Taxonomy Terms') . '</label><p>' . t('Set a hex color value (like #ffffff) to use in the calendar legend for each taxonomy term. Terms with empty values will have no stripe in the calendar and will not be added to the legend. <strong>IMPORTANT!</strong>You must add the taxonomy field, Taxonomy: Term ID, to the view for this to do anything. You can exclude it from output if you do not want to see it in the view, but the field must be included.') . '</p></div>';
$form['calendar_colors_taxonomy']['#tree'] = TRUE;
$colors = $this
->get_option('calendar_colors');
foreach ($taxonomies as $vid => $taxonomy) {
$vocab = taxonomy_get_tree($vid);
foreach ($vocab as $tid => $term) {
$form['calendar_colors_taxonomy']['color'][$term->tid] = array(
'#title' => t($term->name),
'#type' => 'textfield',
'#default_value' => isset($colors_taxonomy[$term->tid]) ? $colors_taxonomy[$term->tid] : '#ffffff',
'#size' => 7,
'#maxlength' => 7,
);
}
}
break;
case 'calendar_colors_group':
$colors_group = $this
->get_option('calendar_colors_group');
$form['#title'] .= t('Group Legend Colors');
$form['calendar_colors_group']['#prefix'] = '';
$form['calendar_colors_group']['#prefix'] .= '<div class="form-item"><label>' . t('Group') . '</label><p>' . t('Set a hex color value (like #ffffff) to use in the calendar legend for each group. Groups with empty values will have no stripe in the calendar and will not be added to the legend.') . '</p></div>';
$form['calendar_colors_group']['#tree'] = TRUE;
$form['calendar_colors_group']['colorpicker'] = array(
'#type' => 'calendar_colorpicker',
'#prefix' => '<div class="clear-block"><div style="float:left">',
'#suffix' => '</div>',
);
$groups = og_all_groups_options();
foreach ($groups as $gid => $group_name) {
$form['calendar_colors_group']['color'][$gid] = array(
'#title' => t($group_name),
'#type' => 'calendar_colorfield',
'#default_value' => isset($colors_group[$gid]) ? $colors_group[$gid] : '#ffffff',
'#calendar_colorpicker' => 'calendar-colors-group-colorpicker',
'#prefix' => '<div style="float:left;margin-right:10px">',
'#suffix' => '</div>',
);
}
$form['calendar_colors_group']['color']['#suffix'] = '</div>';
break;
}
}
/**
* Perform any necessary changes to the form values prior to storage.
* There is no need for this function to actually store the data.
*/
function options_submit(&$form, &$form_state) {
// It is very important to call the parent function here:
parent::options_submit($form, $form_state);
switch ($form_state['section']) {
case 'calendar_popup':
$this
->set_option($form_state['section'], $form_state['values'][$form_state['section']]['popup']);
break;
case 'calendar_colors':
case 'calendar_colors_taxonomy':
case 'calendar_colors_group':
$this
->set_option($form_state['section'], $form_state['values'][$form_state['section']]['color']);
break;
case 'calendar_colors_vocabulary':
$this
->set_option($form_state['section'], array_filter($form_state['values'][$form_state['section']]));
break;
case 'calendar_date_link':
$this
->set_option($form_state['section'], $form_state['values'][$form_state['section']]);
variable_set('calendar_date_link_' . $form_state['values']['calendar_date_link'], $this->display->handler
->get_option('path'));
break;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
calendar_plugin_display_page:: |
function |
List which sections are defaultable and what items each section contains. Overrides views_plugin_display:: |
||
calendar_plugin_display_page:: |
function |
Displays can require a certain type of style plugin. Overrides views_plugin_display:: |
||
calendar_plugin_display_page:: |
function |
Override some of the parent options. Overrides views_object:: |
||
calendar_plugin_display_page:: |
function |
@TODO Figure out how to get the colorpicker working in D7. Overrides views_plugin_display_page:: |
||
calendar_plugin_display_page:: |
function |
Perform any necessary changes to the form values prior to storage.
There is no need for this function to actually store the data. Overrides views_plugin_display_page:: |
||
calendar_plugin_display_page:: |
function |
Provide the summary for attachment options in the views UI. Overrides views_plugin_display_page:: |
||
calendar_plugin_display_page:: |
function |
Add custom option definitions. Overrides views_plugin_display_page:: |
||
calendar_plugin_display_page:: |
function | |||
calendar_plugin_display_page:: |
function |
Render this display. Overrides views_plugin_display:: |
||
calendar_plugin_display_page:: |
function |
Display validation. Overrides views_plugin_display_page:: |
||
views_object:: |
public | property | Handler's definition. | |
views_object:: |
public | property | Except for displays, options for the object will be held here. | 1 |
views_object:: |
function | Collect this handler's option definition and alter them, ready for use. | ||
views_object:: |
public | function | Views handlers use a special construct function. | 4 |
views_object:: |
public | function | ||
views_object:: |
public | function | Always exports the option, regardless of the default value. | |
views_object:: |
public | function | Set default options. | |
views_object:: |
public | function | Let the handler know what its full definition is. | |
views_object:: |
public | function | Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. | |
views_object:: |
public | function | Unpack a single option definition. | |
views_object:: |
public | function | Unpacks each handler to store translatable texts. | |
views_object:: |
public | function | ||
views_plugin:: |
public | property | The current used views display. | |
views_plugin:: |
public | property | The plugin name of this plugin, for example table or full. | |
views_plugin:: |
public | property | The plugin type of this plugin, for example style or query. | |
views_plugin:: |
public | function | Provide a list of additional theme functions for the theme info page. | |
views_plugin:: |
public | function | Return the human readable name of the display. | |
views_plugin:: |
public | function | Returns the summary of the settings in the display. | 8 |
views_plugin:: |
public | function | Provide a full list of possible theme templates used by this style. | |
views_plugin_display:: |
public | property | Stores all available display extenders. | |
views_plugin_display:: |
public | property | List of handlers for this display. | |
views_plugin_display:: |
public | property |
The top object of a view. Overrides views_plugin:: |
|
views_plugin_display:: |
public | function | Can this display accept attachments? | |
views_plugin_display:: |
public | function | Determine if the user has access to this display of the view. | |
views_plugin_display:: |
public | function | Allow displays to attach to other views. | 2 |
views_plugin_display:: |
public | function |
Destructor. Overrides views_object:: |
|
views_plugin_display:: |
public | function | Determine if this display should display the exposed filters widgets. | 1 |
views_plugin_display:: |
public | function | Special method to export items that have handlers. | |
views_plugin_display:: |
public | function |
Override of export_option() Overrides views_object:: |
|
views_plugin_display:: |
public | function | Special handling for plugin export. | |
views_plugin_display:: |
public | function | Special handling for the style export. | |
views_plugin_display:: |
public | function | Format a list of theme templates for output by the theme info helper. | |
views_plugin_display:: |
public | function | Returns to tokens for arguments. | |
views_plugin_display:: |
public | function | List of fields for the current display with the associated relationship. | |
views_plugin_display:: |
public | function | Get the handler object for a single handler. | |
views_plugin_display:: |
public | function | Get a full array of handlers for $type. This caches them. | |
views_plugin_display:: |
public | function | Check to see which display to use when creating links. | |
views_plugin_display:: |
public | function | Intelligently get an option either from this or default display. | |
views_plugin_display:: |
public | function | Return the base path to use for this display. | |
views_plugin_display:: |
public | function | Get the instance of a plugin, for example style or row. | |
views_plugin_display:: |
public | function | Provide the block system with any exposed widget blocks for this display. | |
views_plugin_display:: |
public | function | ||
views_plugin_display:: |
public | function | If this display creates a block, implement one of these. | |
views_plugin_display:: |
public | function | If this display creates a page with a menu item, implement it here. | |
views_plugin_display:: |
public | function | 1 | |
views_plugin_display:: |
public | function | Determine if a given option is set to use the default or current display. | |
views_plugin_display:: |
public | function | If this display is the 'default' display which contains fallback settings. | 1 |
views_plugin_display:: |
public | function | Check if the provided identifier is unique. | |
views_plugin_display:: |
public | function | If override/revert was clicked, perform the proper toggle. | |
views_plugin_display:: |
public | function | Because forms may be split up into sections, this provides an easy URL to exactly the right section. Don't override this. | |
views_plugin_display:: |
public | function | Set an option and force it to be an override. | |
views_plugin_display:: |
public | function | Fully render the display. | 1 |
views_plugin_display:: |
public | function | Set up any variables on the view prior to execution. | |
views_plugin_display:: |
public | function |
Inject anything into the query that the display handler needs. Overrides views_plugin:: |
|
views_plugin_display:: |
public | function | ||
views_plugin_display:: |
public | function | ||
views_plugin_display:: |
public | function | Not all display plugins will support filtering. | |
views_plugin_display:: |
public | function | Render the footer of the view. | |
views_plugin_display:: |
public | function | Render the header of the view. | |
views_plugin_display:: |
public | function | Render the 'more' link. | |
views_plugin_display:: |
public | function | Not all display plugins will suppert pager rendering. | 1 |
views_plugin_display:: |
public | function | Intelligently set an option either from this display or from the default display, if directed to do so. | |
views_plugin_display:: |
public | function | Flip the override setting for the given section. | |
views_plugin_display:: |
public | function | Special method to unpack items that have handlers. | |
views_plugin_display:: |
public | function | Special handling for plugin unpacking. | |
views_plugin_display:: |
public | function | ||
views_plugin_display:: |
public | function | Does this display uses exposed filters? | 2 |
views_plugin_display:: |
public | function | Check to see if the display can put the exposed form in a block. | |
views_plugin_display:: |
public | function | Determine if the display's style uses fields. | |
views_plugin_display:: |
public | function | Check to see if the display has some need to link to another display. | 1 |
views_plugin_display:: |
public | function | Does the display use AJAX? | |
views_plugin_display:: |
public | function | Does the display have groupby enabled? | |
views_plugin_display:: |
public | function | Does the display have a more link enabled? | |
views_plugin_display:: |
public | function | Should the enabled display more link be shown when no more items? | |
views_plugin_display:: |
public | function | Should the enabled display more link being opened in an new window? | |
views_plugin_display:: |
public | function | Does the display have custom link text? | |
views_plugin_display:: |
public | function | Does the display have a pager enabled? | 1 |
views_plugin_display:: |
public | function | Render any special blocks provided for this display. | |
views_plugin_display_page:: |
public | function |
The display page handler returns a normal view, but it also does
a drupal_set_title for the page, and does a views_set_page_view
on the view. Overrides views_plugin_display:: |
1 |
views_plugin_display_page:: |
public | function | Add this display's path information to Drupal's menu system. | |
views_plugin_display_page:: |
public | function |
Provide some helpful text for the arguments. Overrides views_plugin_display:: |
|
views_plugin_display_page:: |
public | function |
Provide some helpful text for pagers. Overrides views_plugin_display:: |
|
views_plugin_display_page:: |
public | function |
The page display has a path. Overrides views_plugin_display:: |
|
views_plugin_display_page:: |
public | function |
Validate the options form. Overrides views_plugin_display:: |
|
views_plugin_display_page:: |
public | function |
Check to see if the display needs a breadcrumb. Overrides views_plugin_display:: |
1 |