public function TextareaWidget::getConfigurationDefinitions in Typed Data API enhancements 8
Defines the supported configuration settings.
If the widget is configurable, this method must define the supported setting values. The definitions may include suiting widgets and widget configurations for generating a configuration form.
Parameters
\Drupal\Core\TypedData\DataDefinitionInterface $definition: The definition of the edited data.
Return value
\Drupal\typed_data\Context\ContextDefinitionInterface[] An array of context definitions describing the configuration values, keyed by configuration setting name. The keys must match the actual keys of the supported configuration.
Overrides FormWidgetInterface::getConfigurationDefinitions
File
- src/Plugin/ TypedDataFormWidget/ TextareaWidget.php, line 111 
Class
- TextareaWidget
- Plugin implementation of the 'textarea' widget.
Namespace
Drupal\typed_data\Plugin\TypedDataFormWidgetCode
public function getConfigurationDefinitions(DataDefinitionInterface $definition) {
  return [
    'label' => DataDefinition::create('string')
      ->setLabel($this
      ->t('Label')),
    'description' => DataDefinition::create('string')
      ->setLabel($this
      ->t('Description')),
    'placeholder' => DataDefinition::create('string')
      ->setLabel($this
      ->t('Placeholder value')),
    'rows' => DataDefinition::create('integer')
      ->setLabel($this
      ->t('Number of rows in the text box')),
    'cols' => DataDefinition::create('integer')
      ->setLabel($this
      ->t('Number of columns in the text box')),
    'resizable' => DataDefinition::create('string')
      ->setLabel($this
      ->t('Controls whether the text area is resizable'))
      ->setDescription($this
      ->t('Allowed values are "none", "vertical", "horizontal", or "both".')),
  ];
}