You are here

public static function FieldConfig::loadByName in Drupal 8

Same name and namespace in other branches
  1. 9 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

static The field config entity if one exists for the provided field name, otherwise NULL.

61 calls to FieldConfig::loadByName()
block_content_add_body_field in core/modules/block_content/block_content.module
Adds the default body field to a custom block type.
BulkDeleteTest::testDeleteField in core/modules/field/tests/src/Kernel/BulkDeleteTest.php
Verify that deleting a field leaves the field data items in the database and that the appropriate Field API functions can operate on the deleted data and field definition.
BulkDeleteTest::testPurgeField in core/modules/field/tests/src/Kernel/BulkDeleteTest.php
Verify that field data items and fields are purged when a field storage is deleted.
BulkDeleteTest::testPurgeFieldStorage in core/modules/field/tests/src/Kernel/BulkDeleteTest.php
Verify that field storages are preserved and purged correctly as multiple fields are deleted and purged.
BulkDeleteTest::testPurgeWithDeletedAndActiveField in core/modules/field/tests/src/Kernel/BulkDeleteTest.php
Tests that recreating a field with the name as a deleted field works.

... See full list

File

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

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);
}