You are here

public function NodeRevisionDelete::getRelativeTime in Node Revision Delete 8

Determine the time value for a node type and a variable type.

Parameters

string $config_name: The config name, can by minimum_age_to_delete or when_to_delete.

int $number: The number representing the variable type.

Return value

int The timestamp representing the relative time for the node type variable.

Overrides NodeRevisionDeleteInterface::getRelativeTime

1 call to NodeRevisionDelete::getRelativeTime()
NodeRevisionDelete::getContentTypeConfigWithRelativeTime in src/NodeRevisionDelete.php
Return the configuration for a content type with the relative time.

File

src/NodeRevisionDelete.php, line 457

Class

NodeRevisionDelete
Class NodeRevisionDelete.

Namespace

Drupal\node_revision_delete

Code

public function getRelativeTime($config_name, $number) {

  // Getting the time interval.
  $time_interval = $this->configFactory
    ->get($this->configurationFileName)
    ->get('node_revision_delete_' . $config_name . '_time')['time'];

  // Getting the relative time.
  $time = strtotime('-' . $number . ' ' . $time_interval);
  return $time;
}