You are here

public static function BgImgItem::propertyDefinitions in Background Image Field 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 ImageItem::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

src/Plugin/Field/FieldType/BgImgItem.php, line 108

Class

BgImgItem
Plugin implementation of the 'bg_img_field' field type.

Namespace

Drupal\bg_img_field\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties = parent::propertyDefinitions($field_definition);
  $properties['css_selector'] = DataDefinition::create('string')
    ->setLabel(t('CSS Selector'))
    ->setDescription(t("CSS selector that will be used to place the background image. attribute."));
  $properties['css_repeat'] = DataDefinition::create('string')
    ->setLabel(t('CSS Repeat Property'))
    ->setDescription(t("CSS attribute that set the repeating value of the background image."));
  $properties['css_background_size'] = DataDefinition::create('string')
    ->setLabel(t('CSS Background Size Property'))
    ->setDescription(t("CSS attribute that set the background size value of the background image."));
  $properties['css_background_position'] = DataDefinition::create('string')
    ->setLabel(t('CSS Background Position Property'))
    ->setDescription(t("CSS attribute that set the background position value of the background image."));
  $properties['hide_css_Settings'] = DataDefinition::create('boolean')
    ->setLabel(t("Hide CSS Settings"))
    ->setDescription(t("Hides CSS settings on edit screens of the background image field type"));
  return $properties;
}