You are here

public function reference_table_formatter_commerce_product_reference::get_bundles in Reference Table Formatter 7

Get a list of bundles which can be referenced by this field.

Return value

array A list of bundles.

Overrides reference_table_formatter_base_type::get_bundles

File

plugins/reference_types/commerce_product_reference.inc, line 16

Class

reference_table_formatter_commerce_product_reference

Code

public function get_bundles() {
  $bundles = array();

  // Check if the bundle has been nominated by the user.
  if (isset($this->instance['settings']['referenceable_types'])) {
    $settings = $this->instance['settings']['referenceable_types'];
    foreach ($settings as $key => $type) {
      if ($type != '0') {
        $bundles[] = $type;
      }
    }
    if (count($bundles) > 0) {
      return $bundles;
    }
  }

  // Otherwise all field references from all bundles.
  $info = entity_get_info($this
    ->entity_name());
  return array_keys($info['bundles']);
}