You are here

public function InviteEmailBaseForm::extractEmailsFrom in Open Social 10.1.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_core/src/Form/InviteEmailBaseForm.php \Drupal\social_core\Form\InviteEmailBaseForm::extractEmailsFrom()
  2. 10.3.x modules/social_features/social_core/src/Form/InviteEmailBaseForm.php \Drupal\social_core\Form\InviteEmailBaseForm::extractEmailsFrom()
  3. 10.0.x modules/social_features/social_core/src/Form/InviteEmailBaseForm.php \Drupal\social_core\Form\InviteEmailBaseForm::extractEmailsFrom()
  4. 10.2.x modules/social_features/social_core/src/Form/InviteEmailBaseForm.php \Drupal\social_core\Form\InviteEmailBaseForm::extractEmailsFrom()

Custom function to extract email addresses from a string.

1 call to InviteEmailBaseForm::extractEmailsFrom()
EnrollInviteEmailForm::validateForm in modules/social_features/social_event/modules/social_event_invite/src/Form/EnrollInviteEmailForm.php
Form validation handler.

File

modules/social_features/social_core/src/Form/InviteEmailBaseForm.php, line 136

Class

InviteEmailBaseForm
Class InviteBaseForm.

Namespace

Drupal\social_core\Form

Code

public function extractEmailsFrom($string) {

  // Remove select2 ID parameter.
  $string = str_replace('$ID:', '', $string);
  preg_match_all("/[\\._a-zA-Z0-9+-]+@[\\._a-zA-Z0-9+-]+/i", $string, $matches);
  return $matches[0];
}