public static function GoogleAnalyticsAdminSettingsForm::validateParameterValues in Google Analytics 8.3
Same name and namespace in other branches
- 4.x src/Form/GoogleAnalyticsAdminSettingsForm.php \Drupal\google_analytics\Form\GoogleAnalyticsAdminSettingsForm::validateParameterValues()
The #element_validate callback for parameters.
Parameters
array $element: An associative array containing the properties and children of the generic form element.
\Drupal\Core\Form\FormStateInterface $form_state: The $form_state array for the form this element belongs to.
See also
form_process_pattern()
File
- src/
Form/ GoogleAnalyticsAdminSettingsForm.php, line 850
Class
- GoogleAnalyticsAdminSettingsForm
- Configure Google_Analytics settings for this site.
Namespace
Drupal\google_analytics\FormCode
public static function validateParameterValues(array $element, FormStateInterface $form_state) {
$values = static::extractParameterValues($element['#value']);
if (!is_array($values)) {
$form_state
->setError($element, t('The %element-title field contains invalid input.', [
'%element-title' => $element['#title'],
]));
}
else {
// Check that name and value are valid for the field type.
foreach ($values as $name => $value) {
if ($error = static::validateParameterName($name)) {
$form_state
->setError($element, $error);
break;
}
if ($error = static::validateParameterValue($value)) {
$form_state
->setError($element, $error);
break;
}
}
$form_state
->setValueForElement($element, $values);
}
}