You are here

public function PatternDataDefinition::getPropertyDefinitions in UI Patterns 8

Gets an array of property definitions of contained properties.

Return value

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

Overrides MapDataDefinition::getPropertyDefinitions

File

src/TypedData/PatternDataDefinition.php, line 38

Class

PatternDataDefinition
Class PatternDefinition.

Namespace

Drupal\ui_patterns\TypedData

Code

public function getPropertyDefinitions() {
  $this
    ->setMainPropertyName('id')
    ->setPropertyDefinition('id', $this
    ->getMachineNameDefinition()
    ->setRequired(TRUE))
    ->setPropertyDefinition('label', DataDefinition::create('string')
    ->setRequired(TRUE))
    ->setPropertyDefinition('base path', DataDefinition::create('string')
    ->setRequired(TRUE))
    ->setPropertyDefinition('file name', DataDefinition::create('string')
    ->setRequired(TRUE))
    ->setPropertyDefinition('provider', DataDefinition::create('string')
    ->setRequired(TRUE))
    ->setPropertyDefinition('fields', $this
    ->getFieldsDefinition())
    ->setPropertyDefinition('variants', $this
    ->getVariantsDefinition())
    ->setPropertyDefinition('theme hook', DataDefinition::create('string')
    ->setRequired(TRUE))
    ->setPropertyDefinition('description', DataDefinition::create('string'))
    ->setPropertyDefinition('use', DataDefinition::create('string'))
    ->setPropertyDefinition('tags', ListDataDefinition::create('string'))
    ->setPropertyDefinition('custom theme hook', DataDefinition::create('boolean'))
    ->setPropertyDefinition('template', DataDefinition::create('string'))
    ->setPropertyDefinition('libraries', DataDefinition::create('any'));
  return $this->propertyDefinitions;
}