You are here

function _bootstrap_tour_generate_entity_selector in Bootstrap Tour 7

Generates a structured array of entity types (and bundles) for use in the form api as a selector

Return value

array

1 call to _bootstrap_tour_generate_entity_selector()
bootstrap_tour_configure_form in ./bootstrap_tour.admin.inc
Implements hook_form()

File

./bootstrap_tour.admin.inc, line 424

Code

function _bootstrap_tour_generate_entity_selector() {
  $entities = array();
  $_options = array();
  foreach (entity_get_info() as $entity_id => $entity_info) {
    $entities[$entity_id] = $entity_info['label'];
    if (count($entity_info['bundles']) > 1) {
      foreach ($entity_info['bundles'] as $bundle_id => $bundle_info) {
        $_options[$entity_info['label']][$entity_id . ':' . $bundle_id] = $bundle_info['label'];
      }
      asort($_options[$entity_info['label']]);
    }
  }
  ksort($_options);
  asort($entities);
  $options = array(
    'ignore' => '<ignore>',
    t('Entities') => $entities,
  ) + $_options;
  return $options;
}