You are here

public static function IssueItem::propertyDefinitions in Simplenews 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldType/IssueItem.php \Drupal\simplenews\Plugin\Field\FieldType\IssueItem::propertyDefinitions()
  2. 3.x src/Plugin/Field/FieldType/IssueItem.php \Drupal\simplenews\Plugin\Field\FieldType\IssueItem::propertyDefinitions()

Defines field item properties.

Properties that are required to constitute a valid, non-empty item should be denoted with \Drupal\Core\TypedData\DataDefinition::setRequired().

Return value

\Drupal\Core\TypedData\DataDefinitionInterface[] An array of property definitions of contained properties, keyed by property name.

Overrides EntityReferenceItem::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

src/Plugin/Field/FieldType/IssueItem.php, line 40

Class

IssueItem
Defines the 'issue' entity field type (extended entity_reference).

Namespace

Drupal\simplenews\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {

  // Call the parent to define the target_id and entity properties.
  $properties = parent::propertyDefinitions($field_definition);
  $properties['handler'] = DataDefinition::create('string')
    ->setLabel(t('Handler'));
  $properties['handler_settings'] = MapDataDefinition::create()
    ->setLabel(t('Handler settings'));
  $properties['status'] = DataDefinition::create('integer')
    ->setLabel(t('Status'))
    ->setSetting('unsigned', TRUE);
  $properties['sent_count'] = DataDefinition::create('integer')
    ->setLabel(t('Sent count'))
    ->setSetting('unsigned', TRUE);
  $properties['error_count'] = DataDefinition::create('integer')
    ->setLabel(t('Error count'))
    ->setSetting('unsigned', TRUE);
  $properties['subscribers'] = DataDefinition::create('integer')
    ->setLabel(t('Subscribers'))
    ->setSetting('unsigned', TRUE);
  return $properties;
}