public function application_manager::rids_to_text in Apply for role 8
Converts an array of RID's into plain text for insertion into email.
Parameters
$rids:
Return value
string
3 calls to application_manager::rids_to_text()
- application_manager::approve_application in src/
application_manager.php - application_manager::create_application in src/
application_manager.php - Create an application.
- application_manager::deny_application in src/
application_manager.php
File
- src/
application_manager.php, line 216 - Contains two classes.
Class
- application_manager
- Application manager object used for performing any tasks relating to applications.
Namespace
Drupal\apply_for_roleCode
public function rids_to_text($rids) {
$replacement_text = '';
$first = TRUE;
$last = count($rids);
// Base zero count of last.
$count = 0;
// @TODO: Convert role_id to presentable non-machine name. For now this works.
foreach ($rids as $role_id) {
$count++;
if ($first) {
$replacement_text .= $role_id;
$first = FALSE;
}
else {
if ($count == $last) {
$replacement_text .= ' and ' . $role_id;
}
else {
$replacement_text .= ', ' . $role_id;
}
}
}
return $replacement_text;
}