ContentEntityBase::getFieldDefinition

public ContentEntityBase::getFieldDefinition($name)

Gets the definition of a contained field.

Parameters

string $name: The name of the field.

Return value

\Drupal\Core\Field\FieldDefinitionInterface|null The definition of the field or null if the field does not exist.

Overrides FieldableEntityInterface::getFieldDefinition

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 552

Class

ContentEntityBase
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

1
2
3
4
5
6
7
8
public function getFieldDefinition($name) {
  if (!isset($this->fieldDefinitions)) {
    $this->getFieldDefinitions();
  }
  if (isset($this->fieldDefinitions[$name])) {
    return $this->fieldDefinitions[$name];
  }
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.