You are here

protected function ComputedFieldItem::executeComputedCode in Computed Field 8

1 call to ComputedFieldItem::executeComputedCode()
ComputedFieldItem::preSave in src/Plugin/Field/FieldType/ComputedFieldItem.php
Defines custom presave behavior for field values.

File

src/Plugin/Field/FieldType/ComputedFieldItem.php, line 229

Class

ComputedFieldItem
Plugin implementation of the 'computed' field type.

Namespace

Drupal\computed_field\Plugin\Field\FieldType

Code

protected function executeComputedCode() {
  $code = $this
    ->getSetting('computed_code');
  $entity_manager = \Drupal::EntityManager();
  $entity = $this
    ->getEntity();
  $fields = $this
    ->getEntity()
    ->toArray();
  $value = NULL;
  eval($code);
  return $value;
}