You are here

function date_restrictions_get_bundle_instances_as_options in Date Restrictions 7

Builds a list of options representing fields.

The return array is keyed by entity_type:bundle:field_name, with a human representation of the same information as values. It is ready to be used as options for a select form element.

See also

date_restrictions_get_bundle_instances().

1 call to date_restrictions_get_bundle_instances_as_options()
date_restrictions_minmax_minmax_settings_form in modules/minmax/date_restrictions_minmax.date_restrictions.inc
Implements minmax_settings_form callback.

File

./date_restrictions.module, line 239

Code

function date_restrictions_get_bundle_instances_as_options($bundles, $field_types = array(
  'date',
  'datetime',
  'datestamp',
)) {
  $options = array();
  $instances = date_restrictions_get_bundle_instances($bundles, $field_types);
  foreach ($instances as $key => $instance) {
    $entity_info = entity_get_info($instance['entity_type']);
    $options[$key] = $entity_info['label'] . ' ' . $entity_info['bundles'][$instance['bundle']]['label'] . ': ' . $instance['label'];
  }
  return $options;
}