You are here

protected function FieldFormatterConditionBase::getEntityFields in Field Formatter Condition 8

Load fields from a entity.

Parameters

string $entity_type: Type of entity.

string $bundle: Entity bundle.

Return value

array Returns the field definitions.

10 calls to FieldFormatterConditionBase::getEntityFields()
HideIfBoolCheck::alterForm in src/Plugin/Field/FieldFormatter/Condition/HideIfBoolCheck.php
Alter the condition form.
HideIfBoolCheck::summary in src/Plugin/Field/FieldFormatter/Condition/HideIfBoolCheck.php
Return the summary string.
HideIfEmpty::alterForm in src/Plugin/Field/FieldFormatter/Condition/HideIfEmpty.php
Alter the condition form.
HideIfEmpty::summary in src/Plugin/Field/FieldFormatter/Condition/HideIfEmpty.php
Return the summary string.
HideIfString::alterForm in src/Plugin/Field/FieldFormatter/Condition/HideIfString.php
Alter the condition form.

... See full list

File

src/Plugin/FieldFormatterConditionBase.php, line 114

Class

FieldFormatterConditionBase
Base class for Field formatter condition plugins.

Namespace

Drupal\fico\Plugin

Code

protected function getEntityFields($entity_type, $bundle) {
  $fields = [];
  $entityManager = \Drupal::service('entity.manager');
  if (!empty($entity_type) && !empty($bundle)) {
    $fields = array_filter($entityManager
      ->getFieldDefinitions($entity_type, $bundle), function ($field_definition) {
      return $field_definition instanceof FieldConfigInterface;
    });
  }
  return $fields;
}