You are here

public function FacetapiDependencyBundle::getBundleOptions in Facet API 7

Same name and namespace in other branches
  1. 6.3 plugins/facetapi/dependency_bundle.inc \FacetapiDependencyBundle::getBundleOptions()
  2. 7.2 plugins/facetapi/dependency_bundle.inc \FacetapiDependencyBundle::getBundleOptions()

Returns an array of bundles suitable for use as options in FAPI elements.

Parameters

array $entity_types: An array containing the machine names of entities to gather bundles for.

Return value

array An associative array keyed by machine name of the bundles to escaped bundle labels.

1 call to FacetapiDependencyBundle::getBundleOptions()
FacetapiDependencyBundle::settingsForm in plugins/facetapi/dependency_bundle.inc
Overrides FacetapiDependency::settingsForm().

File

plugins/facetapi/dependency_bundle.inc, line 136
The bundle dependency class.

Class

FacetapiDependencyBundle
Dependency plugin adding bundle conditions.

Code

public function getBundleOptions(array $entity_types) {
  $options = array();
  foreach ($entity_types as $entity_type) {
    if ($entity_info = entity_get_info($entity_type)) {
      foreach ($entity_info['bundles'] as $bundle => $bundle_info) {
        $options[$bundle] = check_plain($bundle_info['label']);
      }
    }
  }
  return $options;
}