You are here

public function CerNodeReferenceField::getTargetBundles in Corresponding Entity References 7.3

@override CerField::getTargetBundles().

Overrides CerField::getTargetBundles

File

includes/fields/node_reference.inc, line 20
Contains the CER plugin for Node Reference fields.

Class

CerNodeReferenceField
@file Contains the CER plugin for Node Reference fields.

Code

public function getTargetBundles() {
  $bundles = array();
  $view = $this->settings['view']['view_name'];
  if ($view) {
    $view = views_get_view($view);
    $view
      ->set_display($this->settings['view']['view_display']);
    $handler = $view->display_handler
      ->get_handler('filter', 'type');
    if ($handler) {
      $bundles = $handler->value;
    }
  }
  else {
    $bundles = array_filter($this->settings['referenceable_types']);
  }
  return $bundles ? $bundles : parent::getTargetBundles();
}