protected function DevelController::showTimeAndTimeAgo in Search API Solr 8.2
Same name and namespace in other branches
- 8.3 modules/search_api_solr_devel/src/Controller/DevelController.php \Drupal\search_api_solr_devel\Controller\DevelController::showTimeAndTimeAgo()
- 4.x modules/search_api_solr_devel/src/Controller/DevelController.php \Drupal\search_api_solr_devel\Controller\DevelController::showTimeAndTimeAgo()
Given a timestamp it returns both a human-readable date + "time ago".
Parameters
$timestamp:
Return value
\Drupal\Core\StringTranslation\TranslatableMarkup
2 calls to DevelController::showTimeAndTimeAgo()
- DevelController::entitySolr in search_api_solr_devel/
src/ Controller/ DevelController.php - Prints the document structure to be indexed by Solr.
- DevelController::getBaseRow in search_api_solr_devel/
src/ Controller/ DevelController.php - Return a base row for the summary table, which will be modified later on.
File
- search_api_solr_devel/
src/ Controller/ DevelController.php, line 279
Class
- DevelController
- Returns responses for devel module routes.
Namespace
Drupal\search_api_solr_devel\ControllerCode
protected function showTimeAndTimeAgo($timestamp) {
return $this
->t('%time (%time_ago ago)', [
'%time' => \Drupal::service('date.formatter')
->format($timestamp),
'%time_ago' => \Drupal::service('date.formatter')
->formatDiff($timestamp, \Drupal::time()
->getRequestTime()),
]);
}