/** * @TODO Find out why this is never being called. * * Validation for services for BasicToolbox. * @param array $element * @param FormStateInterface $form_state */ public static function addThisDisplayElementServicesValidate($element, FormStateInterface $form_state) { $bad = FALSE; $services = trim($element['#value']); $services = str_replace(' ', '', $services); if (!preg_match('/^[a-z\\_\\,0-9]+$/', $services)) { $bad = TRUE; } // @todo Validate the service names against AddThis.com. Give a notice when there are bad names. // Return error. if ($bad) { $form_state->setErrorByName($element['name'], t('The declared services are incorrect or nonexistent.')); } }