public function SocialBulkGroupInvitation::extractEmailsFrom in Open Social 10.0.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_group/modules/social_group_invite/src/Form/SocialBulkGroupInvitation.php \Drupal\social_group_invite\Form\SocialBulkGroupInvitation::extractEmailsFrom()
- 10.3.x modules/social_features/social_group/modules/social_group_invite/src/Form/SocialBulkGroupInvitation.php \Drupal\social_group_invite\Form\SocialBulkGroupInvitation::extractEmailsFrom()
- 10.1.x modules/social_features/social_group/modules/social_group_invite/src/Form/SocialBulkGroupInvitation.php \Drupal\social_group_invite\Form\SocialBulkGroupInvitation::extractEmailsFrom()
- 10.2.x modules/social_features/social_group/modules/social_group_invite/src/Form/SocialBulkGroupInvitation.php \Drupal\social_group_invite\Form\SocialBulkGroupInvitation::extractEmailsFrom()
Custom function to extract email addresses from a string.
2 calls to SocialBulkGroupInvitation::extractEmailsFrom()
- SocialBulkGroupInvitation::submitForm in modules/
social_features/ social_group/ modules/ social_group_invite/ src/ Form/ SocialBulkGroupInvitation.php - Custom form submit.
- SocialBulkGroupInvitation::validateForm in modules/
social_features/ social_group/ modules/ social_group_invite/ src/ Form/ SocialBulkGroupInvitation.php - Custom form validation.
File
- modules/
social_features/ social_group/ modules/ social_group_invite/ src/ Form/ SocialBulkGroupInvitation.php, line 452
Class
- SocialBulkGroupInvitation
- Class SocialBulkGroupInvitation.
Namespace
Drupal\social_group_invite\FormCode
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);
if (is_array($matches[0]) && count($matches[0]) === 1) {
return reset($matches[0]);
}
return $matches[0];
}