Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FieldConfig.php

function 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.

7 calls to FieldConfig::loadByName()
block_content_add_body_field in core/modules/block_content/block_content.module
Adds the default body field to a block type.
CommentManager::addBodyField in core/modules/comment/src/CommentManager.php
FieldHooks::fieldStorageConfigUpdate in core/modules/field/src/Hook/FieldHooks.php
Implements hook_ENTITY_TYPE_update() for 'field_storage_config'.
LayoutBuilderEntityViewDisplay::addSectionField in core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
Adds a layout section field to a given bundle.
LayoutBuilderEntityViewDisplay::removeSectionField in core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
Removes a layout section field if it is no longer needed.

... See full list

File

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

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);
}
RSS feed
Powered by Drupal