public static function Time::convertWordToTime in Node Revision Delete 8
Return a mapping of the old word values to numeric equivalents.
Parameters
string $word: The old word to map.
Return value
array|string The numeric value when a word is provided or the whole map.
3 calls to Time::convertWordToTime()
- drush_node_revision_delete_nrd_set_time in ./
node_revision_delete.drush.inc - Callback for the nrd-delete-set-time command.
- NodeRevisionDeleteCommands::setTime in src/
Commands/ NodeRevisionDeleteCommands.php - Configures the frequency with which to delete revisions while cron run.
- TimeTest::testConvertWordToTime in tests/
src/ Unit/ Utility/ TimeTest.php - Tests the convertWordToTime() method.
File
- src/
Utility/ Time.php, line 21
Class
- Time
- Provides module internal helper methods.
Namespace
Drupal\node_revision_delete\UtilityCode
public static function convertWordToTime($word = NULL) {
$word_map = [
'never' => '-1',
'every_time' => '0',
'every_hour' => '3600',
'everyday' => '86400',
'every_week' => '604800',
'every_10_days' => '864000',
'every_15_days' => '1296000',
'every_month' => '2592000',
'every_3_months' => '7776000',
'every_6_months' => '15552000',
'every_year' => '31536000',
'every_2_years' => '63072000',
];
return empty($word) ? $word_map : $word_map[$word];
}