function FieldConfig::loadByName

Same name in other branches
  1. 9 core/modules/field/src/Entity/FieldConfig.php \Drupal\field\Entity\FieldConfig::loadByName()
  2. 8.9.x core/modules/field/src/Entity/FieldConfig.php \Drupal\field\Entity\FieldConfig::loadByName()
  3. 10 core/modules/field/src/Entity/FieldConfig.php \Drupal\field\Entity\FieldConfig::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 $bundle: Bundle name.

string $field_name: Name of the field.

Return value

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

69 calls to FieldConfig::loadByName()
AddToAllBundlesConfigActionTest::testIgnoreExistingFields in core/modules/field/tests/src/Kernel/AddToAllBundlesConfigActionTest.php
Tests that the action will ignore existing fields by default.
block_content_add_body_field in core/modules/block_content/block_content.module
Adds the default body field to a block type.
BulkDeleteTest::testDeleteField in core/modules/field/tests/src/Kernel/BulkDeleteTest.php
Tests deleting fields.
BulkDeleteTest::testPurgeField in core/modules/field/tests/src/Kernel/BulkDeleteTest.php
Tests purging fields.
BulkDeleteTest::testPurgeFieldStorage in core/modules/field/tests/src/Kernel/BulkDeleteTest.php
Tests purging field storages.

... See full list

File

core/modules/field/src/Entity/FieldConfig.php, line 377

Class

FieldConfig
Defines the Field entity.

Namespace

Drupal\field\Entity

Code

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

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