protected function PcpService::getNextField in Profile Complete Percent 8
Returns the next field.
Depending on configuration, a random field or the first available field is picked. When random is configured, every time the user reloads the page a different field will be shown.
Parameters
array $fields: The fields to choose from.
Return value
string The field name of the next field. Empty string if not available.
1 call to PcpService::getNextField()
- PcpService::getCompletePercentageData in src/
PcpService.php - Builds array of pcp data.
File
- src/
PcpService.php, line 122
Class
- PcpService
- Class PcpService.
Namespace
Drupal\pcpCode
protected function getNextField(array $fields) {
if (empty($fields)) {
return '';
}
// Return random value if configured to do so.
if ($this->config
->get('field_order') == 0) {
return array_rand($fields);
}
return key($fields);
}