You are here

public static function Schedule::getPeriodTypes in Backup and Migrate 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Entity/Schedule.php \Drupal\backup_migrate\Entity\Schedule::getPeriodTypes()

Get a list of available backup periods.

Only returns time periods which have a (reasonably) consistent number of seconds (ie: no months).

Return value

array The list of available periods, keyed by unit.

2 calls to Schedule::getPeriodTypes()
Schedule::secondsToPeriod in src/Entity/Schedule.php
Convert a number of seconds into a period array.
ScheduleForm::form in src/Form/ScheduleForm.php
Gets the actual form array to be built.

File

src/Entity/Schedule.php, line 295

Class

Schedule
Defines the Schedule entity.

Namespace

Drupal\backup_migrate\Entity

Code

public static function getPeriodTypes() {
  return [
    'seconds' => [
      'type' => 'seconds',
      'seconds' => 1,
      'title' => 'Seconds',
      'singular' => 'Once a second',
      'plural' => 'Every @count seconds',
    ],
    'minutes' => [
      'type' => 'minutes',
      'seconds' => 60,
      'title' => 'Minutes',
      'singular' => 'Once a minute',
      'plural' => 'Every @count minutes',
    ],
    'hours' => [
      'type' => 'hours',
      'seconds' => 3600,
      'title' => 'Hours',
      'singular' => 'Hourly',
      'plural' => 'Every @count hours',
    ],
    'days' => [
      'type' => 'days',
      'seconds' => 86400,
      'title' => 'Days',
      'singular' => 'Daily',
      'plural' => 'Every @count days',
    ],
    'weeks' => [
      'type' => 'weeks',
      'seconds' => 604800,
      'title' => 'Weeks',
      'singular' => 'Weekly',
      'plural' => 'Every @count weeks',
    ],
  ];
}