function TextWithSummaryItem::getConstraints
Same name in other branches
- 9 core/modules/text/src/Plugin/Field/FieldType/TextWithSummaryItem.php \Drupal\text\Plugin\Field\FieldType\TextWithSummaryItem::getConstraints()
- 10 core/modules/text/src/Plugin/Field/FieldType/TextWithSummaryItem.php \Drupal\text\Plugin\Field\FieldType\TextWithSummaryItem::getConstraints()
- 11.x core/modules/text/src/Plugin/Field/FieldType/TextWithSummaryItem.php \Drupal\text\Plugin\Field\FieldType\TextWithSummaryItem::getConstraints()
Overrides TypedData::getConstraints
File
-
core/
modules/ text/ src/ Plugin/ Field/ FieldType/ TextWithSummaryItem.php, line 112
Class
- TextWithSummaryItem
- Plugin implementation of the 'text_with_summary' field type.
Namespace
Drupal\text\Plugin\Field\FieldTypeCode
public function getConstraints() {
$constraints = parent::getConstraints();
if ($this->getSetting('required_summary')) {
$manager = $this->getTypedDataManager()
->getValidationConstraintManager();
$constraints[] = $manager->create('ComplexData', [
'summary' => [
'NotNull' => [
'message' => $this->t('The summary field is required for @name', [
'@name' => $this->getFieldDefinition()
->getLabel(),
]),
],
],
]);
}
return $constraints;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.