PHP FormStateInterface Code Examples

This page contains top rated real world PHP examples of FormStateInterface extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: AddThisBasicToolboxFormTrait.php Project: ChuChuNaKu/addthis
0
 /**
  * @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.'));
     }
 }
Frequently Used Methods