You are here

protected function PatternDataDefinition::getFieldsDefinition in UI Patterns 8

Get definition for 'field' property.

Return value

\Drupal\Core\TypedData\ListDataDefinition Data definition instance.

File

src/TypedData/PatternDataDefinition.php, line 74

Class

PatternDataDefinition
Class PatternDefinition.

Namespace

Drupal\ui_patterns\TypedData

Code

protected function getFieldsDefinition() {
  return new ListDataDefinition([], MapDataDefinition::create()
    ->setPropertyDefinition('name', $this
    ->getMachineNameDefinition()
    ->setRequired(TRUE))
    ->setPropertyDefinition('label', DataDefinition::create('string')
    ->setRequired(TRUE))
    ->setPropertyDefinition('type', $this
    ->getMachineNameDefinition())
    ->setPropertyDefinition('description', DataDefinition::create('string'))
    ->setPropertyDefinition('preview', DataDefinition::create('any')));
}