function OliveroHooks::preprocessSearchResult
Same name and namespace in other branches
- 11.x core/themes/olivero/src/Hook/OliveroHooks.php \Drupal\olivero\Hook\OliveroHooks::preprocessSearchResult()
Implements hook_preprocess_search_result().
Attributes
#[Hook('preprocess_search_result')]
File
-
core/
themes/ olivero/ src/ Hook/ OliveroHooks.php, line 563
Class
- OliveroHooks
- Hook implementations for olivero.
Namespace
Drupal\olivero\HookCode
public function preprocessSearchResult(&$variables) : void {
// Apply custom date formatter to "date" field.
if (!empty($variables['result']['date'])) {
$variables['info_date'] = \Drupal::service('date.formatter')->format($variables['result']['node']->getCreatedTime(), 'olivero_medium');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.