You are here

function date_repeat_field_page in Date 8

Same name and namespace in other branches
  1. 7.3 date_repeat_field/date_repeat_field.module \date_repeat_field_page()
  2. 7.2 date_repeat_field/date_repeat_field.module \date_repeat_field_page()

A page to list all values for a repeating date.

1 string reference to 'date_repeat_field_page'
date_repeat_field_menu in date_repeat_field/date_repeat_field.module
Implements hook_menu().

File

date_repeat_field/date_repeat_field.module, line 147
Creates the option of Repeating date fields and manages Date fields that use the Date Repeat API.

Code

function date_repeat_field_page($entity_type = 'node', $entity = NULL) {
  $bundle = date_get_entity_bundle($entity_type, $entity);
  $info = entity_get_info($entity_type);
  $key = $info['entity keys']['id'];
  drupal_set_title(t('Repeats'));
  $entity->date_repeat_show_all = TRUE;
  $entity->content = array();
  $output = '';
  $fields = field_info_field_map();
  foreach ($fields as $field_name => $value) {
    if (in_array($value['type'], array(
      'date',
    ))) {
      $field = field_info_field($field_name);
      if (date_is_repeat_field($field)) {
        foreach ($value['bundles'] as $entity_type => $bundles) {
          foreach ($bundles as $bundle) {
            $data = field_view_field($entity_type, $entity, $field_name);
            $output .= drupal_render($data);
          }
        }
      }
    }
  }
  return $output;
}