3 namespace Drupal\entity_test\Plugin\Field\FieldType;
5 use Drupal\Core\Field\Plugin\Field\FieldType\IntegerItem;
8 * Defines the 'field_method_invocation_order_test' entity field type.
11 * id = "auto_incrementing_test",
12 * label = @Translation("Auto incrementing test field item"),
13 * description = @Translation("An entity field designed to test the field method invocation order."),
14 * category = @Translation("Number"),
18 class AutoIncrementingTestItem extends IntegerItem {
23 public function preSave() {
25 $this->value = static::getIncrementedFieldValue();
29 * Gets an incremented field value.
32 * The incremented field value.
34 private static function getIncrementedFieldValue() {
35 $current_value = &drupal_static(__METHOD__, 0);
36 return ++$current_value;