You are here

public static function IframeItem::propertyDefinitions in Iframe 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldType/IframeItem.php \Drupal\iframe\Plugin\Field\FieldType\IframeItem::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 FieldItemInterface::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

src/Plugin/Field/FieldType/IframeItem.php, line 45

Class

IframeItem
Plugin implementation of the 'Iframe' field type.

Namespace

Drupal\iframe\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {

  // url as 'string' for token support. Validation of url will occur later
  $properties['url'] = DataDefinition::create('string')
    ->setLabel(t('URL'));
  $properties['title'] = DataDefinition::create('string')
    ->setLabel(t('Title text'));
  $properties['width'] = DataDefinition::create('string')
    ->setLabel(t('Width'));
  $properties['height'] = DataDefinition::create('string')
    ->setLabel(t('Height'));
  $properties['class'] = DataDefinition::create('string')
    ->setLabel(t('Css class'));
  $properties['frameborder'] = DataDefinition::create('string')
    ->setLabel(t('Frameborder'));
  $properties['scrolling'] = DataDefinition::create('string')
    ->setLabel(t('Scrolling'));
  $properties['transparency'] = DataDefinition::create('string')
    ->setLabel(t('Transparency'));
  $properties['tokensupport'] = DataDefinition::create('string')
    ->setLabel(t('Token support'));
  $properties['allowfullscreen'] = DataDefinition::create('string')
    ->setLabel(t('Allow fullscreen'));
  return $properties;
}