You are here

protected function BricksTreeDynamicInlineWidget::getTargetBundles in Bricks​ 2.x

Same name and namespace in other branches
  1. 8 modules/bricks_dynamic/src/Plugin/Field/FieldWidget/BricksTreeDynamicInlineWidget.php \Drupal\bricks_dynamic\Plugin\Field\FieldWidget\BricksTreeDynamicInlineWidget::getTargetBundles()

Gets the target bundles for the current field.

Return value

string[] A list of bundles.

File

modules/bricks_dynamic/src/Plugin/Field/FieldWidget/BricksTreeDynamicInlineWidget.php, line 130

Class

BricksTreeDynamicInlineWidget
Plugin annotation @FieldWidget( id = "bricks_tree_dynamic_inline", label = @Translation("Bricks tree Dynamic (Inline entity form)"), description = @Translation("A tree of inline entity forms."), field_types = { "bricks_dynamic" }, …

Namespace

Drupal\bricks_dynamic\Plugin\Field\FieldWidget

Code

protected function getTargetBundles() {
  $target_bundles = [];
  $entity_type = $this
    ->getEntityType();
  $field_settings = $this
    ->getFieldSettings();
  if (isset($field_settings[$entity_type]) && isset($field_settings[$entity_type]['handler_settings']['target_bundles'])) {
    $entity_type_settings = $field_settings[$entity_type];
    $target_bundles = array_values($entity_type_settings['handler_settings']['target_bundles']);
  }
  return $target_bundles;
}