You are here

public function FieldValidationRuleSet::addFieldValidationRule in Field Validation 8

Saves a FieldValidationRule for this Field Validation ruleset.

Parameters

array $configuration: An array of FieldValidationRule configuration.

Return value

string The FieldValidationRule ID.

Overrides FieldValidationRuleSetInterface::addFieldValidationRule

File

src/Entity/FieldValidationRuleSet.php, line 166

Class

FieldValidationRuleSet
Defines a field validation rule set configuration entity.

Namespace

Drupal\field_validation\Entity

Code

public function addFieldValidationRule(array $configuration) {
  $configuration['uuid'] = $this
    ->uuidGenerator()
    ->generate();
  $this
    ->getFieldValidationRules()
    ->addInstanceId($configuration['uuid'], $configuration);
  return $configuration['uuid'];
}