You are here

protected function BricksTreeDynamicInlineWidget::getEntityType in Bricks​ 8

Same name and namespace in other branches
  1. 2.x modules/bricks_dynamic/src/Plugin/Field/FieldWidget/BricksTreeDynamicInlineWidget.php \Drupal\bricks_dynamic\Plugin\Field\FieldWidget\BricksTreeDynamicInlineWidget::getEntityType()
6 calls to BricksTreeDynamicInlineWidget::getEntityType()
BricksTreeDynamicInlineWidget::createInlineFormHandler in modules/bricks_dynamic/src/Plugin/Field/FieldWidget/BricksTreeDynamicInlineWidget.php
Creates an instance of the inline form handler for the current entity type.
BricksTreeDynamicInlineWidget::formElement in modules/bricks_dynamic/src/Plugin/Field/FieldWidget/BricksTreeDynamicInlineWidget.php
Returns the form for a single field widget.
BricksTreeDynamicInlineWidget::getAccessHandler in modules/bricks_dynamic/src/Plugin/Field/FieldWidget/BricksTreeDynamicInlineWidget.php
Gets the access handler for the target entity type.
BricksTreeDynamicInlineWidget::getFieldSetting in modules/bricks_dynamic/src/Plugin/Field/FieldWidget/BricksTreeDynamicInlineWidget.php
Returns the value of a field setting.
BricksTreeDynamicInlineWidget::getFieldSettings in modules/bricks_dynamic/src/Plugin/Field/FieldWidget/BricksTreeDynamicInlineWidget.php
Returns the array of field settings.

... See full list

File

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

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 getEntityType() {
  $name = $this->fieldDefinition
    ->getName();

  // TODO explain why this is used.
  if (isset($_POST[$name]['actions']['entity_type'])) {
    return $_POST[$name]['actions']['entity_type'];
  }
  $entity_types = DynamicEntityReferenceItem::getTargetTypes($this->fieldDefinition
    ->getSettings());
  if (isset($entity_types[0])) {
    return $entity_types[0];
  }
}