You are here

public static function FieldItemBase::mainPropertyName in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Field/FieldItemBase.php \Drupal\Core\Field\FieldItemBase::mainPropertyName()

Returns the name of the main property, if any.

Some field items consist mainly of one main property, e.g. the value of a text field or the

target_id;

of an entity reference. If the field item has no main property, the method returns NULL.

Return value

string|null The name of the value property, or NULL if there is none.

Overrides FieldItemInterface::mainPropertyName

See also

\Drupal\Core\Field\BaseFieldDefinition

4 methods override FieldItemBase::mainPropertyName()
CommentItem::mainPropertyName in core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
Returns the name of the main property, if any.
EntityReferenceItem::mainPropertyName in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
Returns the name of the main property, if any.
LinkItem::mainPropertyName in core/modules/link/src/Plugin/Field/FieldType/LinkItem.php
Returns the name of the main property, if any.
MapItem::mainPropertyName in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/MapItem.php
Returns the name of the main property, if any.

File

core/lib/Drupal/Core/Field/FieldItemBase.php, line 44
Contains \Drupal\Core\Field\FieldItemBase.

Class

FieldItemBase
An entity field item.

Namespace

Drupal\Core\Field

Code

public static function mainPropertyName() {
  return 'value';
}