Skip to content
Snippets Groups Projects
Commit 362dfb00 authored by Kevin Paxman's avatar Kevin Paxman
Browse files

EXPHR: code standards and update link

parent 5bbaee8b
No related branches found
No related tags found
3 merge requests!297Feature/istwcms 5983 bulk account creation,!274Draft: ISTWCMS-5551: fixing office hours display,!260Feature/istwcms 5668 a5kulkar rename references to publications
...@@ -25,7 +25,7 @@ class UwAddUsersForm extends FormBase { ...@@ -25,7 +25,7 @@ class UwAddUsersForm extends FormBase {
// The list of users from this form. // The list of users from this form.
$form['users'] = [ $form['users'] = [
'#title' => $this->t('WatIAM user ID(s): (maximum 8 characters per ID)'), '#title' => $this->t('WatIAM user ID(s): (maximum 8 characters per ID)'),
'#description' => $this->t('Enter a single WatIAM user ID, or multiple WatIAM user IDs, one per line. All letters will be converted to lower case. Duplicates will be ignored.<br>You can use <a href="https://idm.uwaterloo.ca/search/" target="_blank">authenticated WatIAM search</a> if you don\'t know their user ID (will open a new window).'), '#description' => $this->t('Enter a single WatIAM user ID, or multiple WatIAM user IDs, one per line. All letters will be converted to lower case. Duplicates will be ignored.<br>You can use <a href="https://iamtools.uwaterloo.ca/directory/" target="_blank">authenticated campus people directory</a> if you don\'t know their user ID (will open a new window).'),
'#type' => 'textarea', '#type' => 'textarea',
'#required' => TRUE, '#required' => TRUE,
]; ];
...@@ -68,13 +68,13 @@ class UwAddUsersForm extends FormBase { ...@@ -68,13 +68,13 @@ class UwAddUsersForm extends FormBase {
// Don't process long user IDs. // Don't process long user IDs.
if (strlen($user) > 8) { if (strlen($user) > 8) {
$this->messenger()->addError($this->t('The user ID <em>@user</em> is too long and was skipped.', [ '@user' => $user ] )); $this->messenger()->addError($this->t('The user ID <em>@user</em> is too long and was skipped.', ['@user' => $user]));
continue; continue;
} }
// Don't process user IDs with invalid characters. // Don't process user IDs with invalid characters.
if (!preg_match('/^[a-z0-9]+$/', $user)) { if (!preg_match('/^[a-z0-9]+$/', $user)) {
$this->messenger()->addError($this->t('The user ID <em>@user</em> contains invalid characters and was skipped.', [ '@user' => $user ] )); $this->messenger()->addError($this->t('The user ID <em>@user</em> contains invalid characters and was skipped.', ['@user' => $user]));
continue; continue;
} }
...@@ -110,7 +110,7 @@ class UwAddUsersForm extends FormBase { ...@@ -110,7 +110,7 @@ class UwAddUsersForm extends FormBase {
// Do the LDAP lookup. // Do the LDAP lookup.
$person = \Drupal::service('uw_cfg_common.uw_ldap')->lookupPerson($user); $person = \Drupal::service('uw_cfg_common.uw_ldap')->lookupPerson($user);
if (!$person) { if (!$person) {
$this->messenger()->addError($this->t('The user ID <em>@user</em> could not be found (or was set to private) and was skipped.', [ '@user' => $user ] )); $this->messenger()->addError($this->t('The user ID <em>@user</em> could not be found (or was set to private) and was skipped.', ['@user' => $user]));
continue; continue;
} }
$firstname = empty($person['givenname'][0]) ? 'Firstname' : $person['givenname'][0]; $firstname = empty($person['givenname'][0]) ? 'Firstname' : $person['givenname'][0];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment