You are here

function calendar_plugin_style::granularity in Calendar 7.3

Inspect argument and view information to see which calendar period we should show. The argument tells us what to use if there is no value, the view args tell us what to use if there are values.

1 call to calendar_plugin_style::granularity()
calendar_plugin_style::render in includes/calendar_plugin_style.inc
Render the display in this style.

File

includes/calendar_plugin_style.inc, line 203
Views style plugin for the Calendar module.

Class

calendar_plugin_style
Default style plugin to render an iCal feed.

Code

function granularity() {
  if (!($handler = $this
    ->date_argument_handler())) {
    return 'month';
  }
  $default_granularity = !empty($handler) && !empty($handler->granularity) ? $handler->granularity : 'month';
  $wildcard = !empty($handler) ? $handler->options['exception']['value'] : '';
  $argument = $handler->argument;

  // TODO Anything else we need to do for 'all' arguments?
  if ($argument == $wildcard) {
    $this->view_granularity = $default_granularity;
  }
  elseif (!empty($argument)) {
    module_load_include('inc', 'date_api', 'date_api_sql');
    $date_handler = new date_sql_handler();
    $this->view_granularity = $date_handler
      ->arg_granularity($argument);
  }
  else {
    $this->view_granularity = $default_granularity;
  }
  return $this->view_granularity;
}