protected function WidgetValidationBase::getDataDefinition in Entity Browser 8
Same name and namespace in other branches
- 8.2 src/WidgetValidationBase.php \Drupal\entity_browser\WidgetValidationBase::getDataDefinition()
Gets a data definition and optionally adds a constraint.
Parameters
string $data_type: The data type plugin ID, for which a constraint should be added.
string $constraint_name: The name of the constraint to add, i.e. its plugin id.
array $options: Array of options needed by the constraint validator.
Return value
\Drupal\Core\TypedData\DataDefinitionInterface A data definition object for the given data type.
1 call to WidgetValidationBase::getDataDefinition()
- WidgetValidationBase::validate in src/
WidgetValidationBase.php - Validates the widget.
File
- src/
WidgetValidationBase.php, line 111
Class
- WidgetValidationBase
- Base implementation for widget validation plugins.
Namespace
Drupal\entity_browserCode
protected function getDataDefinition($data_type, $constraint_name = NULL, array $options = []) {
$data_definition = $this->typedDataManager
->createDataDefinition($data_type);
if ($constraint_name) {
$data_definition
->addConstraint($constraint_name, $options);
}
return $data_definition;
}