You are here

ComputedFieldStronglyTypedItemTrait.php in Computed Field 3.x

File

src/Plugin/Field/FieldType/ComputedFieldStronglyTypedItemTrait.php
View source
<?php

namespace Drupal\computed_field\Plugin\Field\FieldType;


/**
 * Common methods for strongly typed Computed Field FieldType plugins.
 *
 * This trait is necessary for Computed Field FieldType plugins that override
 * executeCode() to return specific types.  Any code that requires the raw
 * result must get it from the parent.  An example of this is checking for empty
 * values, which fails if the type is no longer null or the empty string.
 */
trait ComputedFieldStronglyTypedItemTrait {

  /**
   * {@inheritdoc}
   */
  protected function getRawResult() {
    return parent::executeCode();
  }

}

Traits

Namesort descending Description
ComputedFieldStronglyTypedItemTrait Common methods for strongly typed Computed Field FieldType plugins.