function FieldStorageConfig::loadByName

Same name and namespace in other branches
  1. 11.x core/modules/field/src/Entity/FieldStorageConfig.php \Drupal\field\Entity\FieldStorageConfig::loadByName()
  2. 10 core/modules/field/src/Entity/FieldStorageConfig.php \Drupal\field\Entity\FieldStorageConfig::loadByName()
  3. 9 core/modules/field/src/Entity/FieldStorageConfig.php \Drupal\field\Entity\FieldStorageConfig::loadByName()
  4. 8.9.x core/modules/field/src/Entity/FieldStorageConfig.php \Drupal\field\Entity\FieldStorageConfig::loadByName()

Loads a field config entity based on the entity type and field name.

Parameters

string $entity_type_id: ID of the entity type.

string $field_name: Name of the field.

Return value

\Drupal\field\FieldStorageConfigInterface|null The field config entity if one exists for the provided field name, otherwise NULL.

53 calls to FieldStorageConfig::loadByName()
AddToAllBundlesConfigActionTest::testFailIfExists in core/modules/field/tests/src/Kernel/AddToAllBundlesConfigActionTest.php
Tests that the action can be set to fail if the field already exists.
AddToAllBundlesConfigActionTest::testIgnoreExistingFields in core/modules/field/tests/src/Kernel/AddToAllBundlesConfigActionTest.php
Tests that the action will ignore existing fields by default.
BlockContentFieldFilterTest::setUp in core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php
Sets up the test.
block_content_add_body_field in core/modules/block_content/block_content.module
Adds the default body field to a block type.
BodyFieldCreationTrait::createBodyField in core/modules/field/tests/src/Traits/BodyFieldCreationTrait.php
Creates a field of an body field storage on the specified bundle.

... See full list

File

core/modules/field/src/Entity/FieldStorageConfig.php, line 848

Class

FieldStorageConfig
Defines the Field storage configuration entity.

Namespace

Drupal\field\Entity

Code

public static function loadByName($entity_type_id, $field_name) {
  return \Drupal::entityTypeManager()->getStorage('field_storage_config')
    ->load($entity_type_id . '.' . $field_name);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.