function partial_date_components in Partial Date 7
These are the core components that always exist, but are shown or hidden depending on the selected field settings.
17 calls to partial_date_components()
- partial_date_field_estimates_settings_form in ./
partial_date.admin.inc - Helper function to duplicate the same settings on both the instance and field settings.
- partial_date_field_is_empty in ./
partial_date.module - Implements hook_field_is_empty().
- partial_date_field_load in ./
partial_date.module - Implements hook_field_load().
- partial_date_field_populate_components in ./
partial_date.admin.inc - This generates the best estimate for the date components based on the submitted values.
- partial_date_field_presave_generate_storage_date in ./
partial_date.admin.inc - Wrapper to set the storage column.
File
- ./
partial_date.module, line 1004 - Defines a date element that allows for any combination of date granularity settings.
Code
function partial_date_components(array $excluded_components = NULL) {
static $components = NULL;
if (!isset($components)) {
$components = array(
'year' => t('Year', array(), array(
'context' => 'datetime',
)),
'month' => t('Month', array(), array(
'context' => 'datetime',
)),
'day' => t('Day', array(), array(
'context' => 'datetime',
)),
'hour' => t('Hour', array(), array(
'context' => 'datetime',
)),
'minute' => t('Minute', array(), array(
'context' => 'datetime',
)),
'second' => t('Second', array(), array(
'context' => 'datetime',
)),
'timezone' => t('Timezone', array(), array(
'context' => 'datetime',
)),
);
}
if ($excluded_components) {
return array_diff_key($components, array_flip($excluded_components));
}
return $components;
}