You are here

public static function RulesDataUIBundleEntity::optionsList in Rules 7.2

Implements RulesDataInputOptionsListInterface::optionsList().

Overrides RulesDataInputOptionsListInterface::optionsList

File

ui/ui.data.inc, line 637
Contains data type related forms.

Class

RulesDataUIBundleEntity
Data UI variant displaying a select list of available bundle entities.

Code

public static function optionsList(RulesPlugin $element, $name) {
  list($data_type, $parameter_info) = RulesDataUI::getTypeInfo($element, $name);
  $bundles = array();
  $entity_info = entity_get_info();
  $bundle_of_type = $entity_info[$data_type]['bundle of'];
  if (isset($entity_info[$bundle_of_type]['bundles'])) {
    foreach ($entity_info[$bundle_of_type]['bundles'] as $bundle_name => $bundle_info) {
      $bundles[$bundle_name] = $bundle_info['label'];
    }
  }
  return $bundles;
}