You are here

function publication_date_ds_fields_info in Publication Date 8

Same name and namespace in other branches
  1. 7.2 publication_date.ds_fields_info.inc \publication_date_ds_fields_info()

Implements hook_ds_fields_info().

File

./publication_date.ds_fields_info.inc, line 11
Display Suite Integration

Code

function publication_date_ds_fields_info($entity_type) {
  $fields = array();
  if ($entity_type == 'node') {

    // Get the time format specified in date/time.
    $format_types = system_get_date_types();
    $date_formatters = array();
    foreach ($format_types as $formatter) {
      $date_formatters['publication_date_' . $formatter['type']] = t($formatter['title']);
    }
    $fields['node']['published_on'] = array(
      'title' => t('Published on'),
      'field_type' => DS_FIELD_TYPE_FUNCTION,
      'function' => 'publication_date_render_published_at_field',
      'file' => drupal_get_path('module', 'publication_date') . '/publication_date.ds_fields_info.inc',
      'properties' => array(
        'formatters' => $date_formatters,
      ),
    );
    if (isset($fields[$entity_type])) {
      return array(
        $entity_type => $fields[$entity_type],
      );
    }
    return;
  }
}