public function NodeRevisionDelete::getTimeString in Node Revision Delete 8
Return the time string for the config_name parameter.
Parameters
string $config_name: The config name (minimum_age_to_delete|when_to_delete).
int $number: The number for the $config_name parameter configuration.
Return value
string The time string for the $config_name parameter.
Overrides NodeRevisionDeleteInterface::getTimeString
File
- src/
NodeRevisionDelete.php, line 130
Class
- NodeRevisionDelete
- Class NodeRevisionDelete.
Namespace
Drupal\node_revision_deleteCode
public function getTimeString($config_name, $number) {
// Getting the config.
$config_name_time = $this->configFactory
->get($this->configurationFileName)
->get('node_revision_delete_' . $config_name . '_time');
// Is singular or plural?
$time = $this
->getTimeNumberString($number, $config_name_time['time']);
// Return the time string for the $config_name parameter.
$result = '';
switch ($config_name) {
case 'minimum_age_to_delete':
$result = $number . ' ' . $time;
break;
case 'when_to_delete':
$result = $this
->t('After @number @time of inactivity', [
'@number' => $number,
'@time' => $time,
]);
break;
}
return $result;
}