You are here

protected function FieldAttributeConverter::findFieldStorageFormatter in Apigee Edge 8

Finds the storage formatter that is appropriate for a given field.

Parameters

string $entity_type: The entity type.

string $field_name: Name of the field to look up the plugin for.

Return value

\Drupal\apigee_edge\Plugin\FieldStorageFormatInterface|null Null if not found.

2 calls to FieldAttributeConverter::findFieldStorageFormatter()
FieldAttributeConverter::getAttributeValueFromField in src/FieldAttributeConverter.php
Generate attribute value from field's value.
FieldAttributeConverter::getFieldValueFromAttribute in src/FieldAttributeConverter.php
Gets field value from the related attribute.

File

src/FieldAttributeConverter.php, line 144

Class

FieldAttributeConverter
Default field-attribute converter service implementation.

Namespace

Drupal\apigee_edge

Code

protected function findFieldStorageFormatter(string $entity_type, string $field_name) : ?FieldStorageFormatInterface {
  if (!isset($this->fieldDefinitions[$entity_type])) {
    $this->fieldDefinitions[$entity_type] = $this->entityFieldManager
      ->getFieldDefinitions($entity_type, $entity_type);
  }
  if (!isset($this->fieldDefinitions[$entity_type][$field_name])) {
    return NULL;
  }
  $type = $this->fieldDefinitions[$entity_type][$field_name]
    ->getType();
  return $this->formatManager
    ->lookupPluginForFieldType($type);
}