public function DateArgumentWrapper::getGranularity in Calendar 8
2 calls to DateArgumentWrapper::getGranularity()
- DateArgumentWrapper::getMaxDate in src/
DateArgumentWrapper.php - Function to get max date.
- DateArgumentWrapper::getMinDate in src/
DateArgumentWrapper.php - Function to get min date.
File
- src/
DateArgumentWrapper.php, line 148
Class
- DateArgumentWrapper
- The DateArgumentWrapper class.
Namespace
Drupal\calendarCode
public function getGranularity() {
$plugin_id = $this->dateArg
->getPluginId();
$plugin_granularity = str_replace('datetime_', '', $plugin_id);
$plugin_granularity = str_replace('date_', '', $plugin_granularity);
switch ($plugin_granularity) {
case 'year_month':
return 'month';
break;
// Views and Datetime module don't use same suffix :(.
case 'full_date':
case 'fulldate':
return 'day';
break;
case 'year':
return 'year';
break;
case 'year_week':
return 'week';
break;
}
}