TestItem.php

Contains \Drupal\field_test\Type\TestItem.

Namespace

Drupal\field_test\Type

File

drupal/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Type/TestItem.php
View source
<?php

/**
 * @file
 * Contains \Drupal\field_test\Type\TestItem.
 */
namespace Drupal\field_test\Type;

use Drupal\Core\Entity\Field\FieldItemBase;

/**
 * Defines the 'test_field' entity field item.
 */
class TestItem extends FieldItemBase {

  /**
   * Property definitions of the contained properties.
   *
   * @see TestItem::getPropertyDefinitions()
   *
   * @var array
   */
  static $propertyDefinitions;

  /**
   * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions().
   */
  public function getPropertyDefinitions() {
    if (!isset(static::$propertyDefinitions)) {
      static::$propertyDefinitions['value'] = array(
        'type' => 'integer',
        'label' => t('Test integer value'),
      );
    }
    return static::$propertyDefinitions;
  }

}

Classes

Namesort descending Description
TestItem Defines the 'test_field' entity field item.