You are here

public function ChainConditionBase::validateConfiguration in Access Filter 8

Validates configuration data.

Parameters

array $configuration: The array containing configurations.

Return value

array An array of error messages.

Overrides ConditionInterface::validateConfiguration

File

src/Plugin/AccessFilter/Condition/ChainConditionBase.php, line 68

Class

ChainConditionBase
Base class for condition plugins that chains other conditions.

Namespace

Drupal\access_filter\Plugin\AccessFilter\Condition

Code

public function validateConfiguration(array $configuration) {
  $errors = [];
  foreach ($configuration['conditions'] as $condition) {
    $instance = $this
      ->createPluginInstance($condition);
    if ($instance) {
      $errors = array_merge($errors, $instance
        ->validateConfiguration($condition));
    }
    else {
      $errors[] = $this
        ->t("Condition type '@type' does not exist.", [
        '@type' => $condition['type'],
      ]);
    }
  }
  return $errors;
}