$form_state->setErrorByName('settings',t('The following keys are not URL-friendly: @keys. Make sure you use only alpha-numeric characters and hyphens.',[
'@keys'=>implode(", ",$failed_validation),
]));
}
}
/**
* Helper to check allowed_values keys against a URL-friendly pattern.
*
* @param array $allowed_values
* An associative array of allowed values, as stored in list_string field
* storages.
*
* @return array
* An indexed array of keys that failed URL-friendly validation.