You are here

public function ComputedFieldItemTrait::executeCode in Computed Field 3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldType/ComputedFieldItemTrait.php \Drupal\computed_field\Plugin\Field\FieldType\ComputedFieldItemTrait::executeCode()

Performs the field value computation.

If this method is being overridden to return a typed result, the class must use ComputedFieldStronglyTypedItemTrait to ensure access to raw results.

See also

ComputedFieldStronglyTypedItemTrait

5 calls to ComputedFieldItemTrait::executeCode()
ComputedDecimalItem::executeCode in src/Plugin/Field/FieldType/ComputedDecimalItem.php
ComputedFieldItemTrait::getRawResult in src/Plugin/Field/FieldType/ComputedFieldItemTrait.php
Fetches the raw result of the computation.
ComputedFieldItemTrait::preSave in src/Plugin/Field/FieldType/ComputedFieldItemTrait.php
ComputedIntegerItem::executeCode in src/Plugin/Field/FieldType/ComputedIntegerItem.php
ComputedStringItem::executeCode in src/Plugin/Field/FieldType/ComputedStringItem.php
3 methods override ComputedFieldItemTrait::executeCode()
ComputedDecimalItem::executeCode in src/Plugin/Field/FieldType/ComputedDecimalItem.php
ComputedIntegerItem::executeCode in src/Plugin/Field/FieldType/ComputedIntegerItem.php
ComputedStringItem::executeCode in src/Plugin/Field/FieldType/ComputedStringItem.php

File

src/Plugin/Field/FieldType/ComputedFieldItemTrait.php, line 54

Class

ComputedFieldItemTrait
Common methods for Computed Field FieldType plugins.

Namespace

Drupal\computed_field\Plugin\Field\FieldType

Code

public function executeCode() {
  $entity = $this
    ->getEntity();
  $delta = $this->name;
  $field_name = $this->definition
    ->getFieldDefinition()
    ->getName();
  $value = \Drupal::service('computed_field.helpers')
    ->executeCode($field_name, $entity, $delta);
  return $value;
}