You are here

protected function BlazyCreationTestTrait::getBlazyFieldDefinition in Blazy 8

Same name and namespace in other branches
  1. 8.2 tests/src/Traits/BlazyCreationTestTrait.php \Drupal\Tests\blazy\Traits\BlazyCreationTestTrait::getBlazyFieldDefinition()

Gets the field definition.

Parameters

string $field_name: Formatted field name.

Return value

\Drupal\Core\Field\FieldDefinitionInterface The field definition.

See also

BaseFieldDefinition::createFromFieldStorageDefinition()

1 call to BlazyCreationTestTrait::getBlazyFieldDefinition()
BlazyCreationTestTrait::getFormatterInstance in tests/src/Traits/BlazyCreationTestTrait.php
Returns the field formatter instance.

File

tests/src/Traits/BlazyCreationTestTrait.php, line 97

Class

BlazyCreationTestTrait
A Trait common for Blazy tests.

Namespace

Drupal\Tests\blazy\Traits

Code

protected function getBlazyFieldDefinition($field_name = '') {
  if (!$this->fieldDefinition) {
    $field_name = empty($field_name) ? $this->testFieldName : $field_name;
    $field_storage_config = $this
      ->getBlazyFieldStorageDefinition($field_name);
    if ($field_storage_config) {
      $this->fieldDefinition = BaseFieldDefinition::createFromFieldStorageDefinition($field_storage_config);
    }
  }
  return $this->fieldDefinition;
}