You are here

public static function GridFieldType::propertyDefinitions in Paragraphs grid 8

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 FieldItemInterface::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

src/Plugin/Field/FieldType/GridFieldType.php, line 109

Class

GridFieldType
Plugin implementation of the 'grid_field_type' field type.

Namespace

Drupal\paragraphs_grid\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {

  // Prevent early t() calls by using the TranslatableMarkup.
  $properties['value'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Grid classes'))
    ->setSetting('case_sensitive', TRUE)
    ->setRequired(FALSE);
  $properties['view_mode'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('View mode'))
    ->setSetting('case_sensitive', TRUE)
    ->setRequired(FALSE);
  return $properties;
}