You are here

public static function WorkflowManager::getAttachedFields in Workflow 8

Returns the attached fields (via Field UI)

Parameters

string $entity_type_id:

string $bundle:

Return value

array

Overrides WorkflowManagerInterface::getAttachedFields

3 calls to WorkflowManager::getAttachedFields()
WorkflowDefaultWidget::formElement in src/Plugin/Field/FieldWidget/WorkflowDefaultWidget.php
Be careful: Widget may be shown in very different places. Test carefully!!
WorkflowTransition::isEmpty in src/Entity/WorkflowTransition.php
Check if anything has changed in this transition.
WorkflowTransitionElement::copyFormValuesToTransition in src/Element/WorkflowTransitionElement.php
Implements ContentEntityForm::copyFormValuesToEntity().

File

src/Entity/WorkflowManager.php, line 383

Class

WorkflowManager
Manages entity type plugin definitions.

Namespace

Drupal\workflow\Entity

Code

public static function getAttachedFields($entity_type_id, $bundle) {
  $added_fields = [];

  // Determine the fields added by Field UI.
  $entity_field_manager = \Drupal::service('entity_field.manager');

  // $extra_fields = $this->entityFieldManager->getExtraFields($entity_type_id, $bundle);
  // $base_fields = $this->entityFieldManager->getBaseFieldDefinitions($entity_type_id, $bundle);
  $fields = $entity_field_manager
    ->getFieldDefinitions($entity_type_id, $bundle);
  foreach ($fields as $key => $field) {

    // Remove BaseFieldDefinition, BaseFieldOverride.
    if ($field instanceof FieldConfig) {
      $added_fields[$key] = $field;
    }
  }
  return $added_fields;
}