You are here

public function NodeRevisionDelete::getTimeNumberString in Node Revision Delete 8

Return the time option in singular or plural.

Parameters

string $number: The number.

string $time: The time option (days, weeks or months).

Return value

string The singular or plural value for the time.

Overrides NodeRevisionDeleteInterface::getTimeNumberString

1 call to NodeRevisionDelete::getTimeNumberString()
NodeRevisionDelete::getTimeString in src/NodeRevisionDelete.php
Return the time string for the config_name parameter.

File

src/NodeRevisionDelete.php, line 156

Class

NodeRevisionDelete
Class NodeRevisionDelete.

Namespace

Drupal\node_revision_delete

Code

public function getTimeNumberString($number, $time) {

  // Time options.
  $time_options = [
    'days' => [
      'singular' => $this
        ->t('day'),
      'plural' => $this
        ->t('days'),
    ],
    'weeks' => [
      'singular' => $this
        ->t('week'),
      'plural' => $this
        ->t('weeks'),
    ],
    'months' => [
      'singular' => $this
        ->t('month'),
      'plural' => $this
        ->t('months'),
    ],
  ];
  return $number == 1 ? $time_options[$time]['singular'] : $time_options[$time]['plural'];
}