You are here

function _civicrm_entity_timestamp_addformatters in CiviCRM Entity 7.2

Utility function to provide date fields with custom PHP date formatting

Parameters

$entity_type:

$date_fields:

$fields:

1 call to _civicrm_entity_timestamp_addformatters()
civicrm_entity_ds_fields_info in ./civicrm_entity.module
Implements hook_ds_fields_info().

File

./civicrm_entity.ds.inc, line 168

Code

function _civicrm_entity_timestamp_addformatters($entity_type, $date_fields, &$fields) {
  $date_types = system_get_date_types();
  $date_options = array();
  foreach ($date_types as $name => $values) {
    $date_options[$name] = $values['title'];
  }
  foreach ($date_fields as $date_field) {
    $fields[$entity_type][$date_field]['properties']['formatters'] = array(
      'default' => 'Default',
      'civicrm_timestamp' => 'Date',
    );
    $fields[$entity_type][$date_field]['properties']['settings']['date type'] = array(
      'type' => 'select',
      'options' => $date_options,
    );
  }
}