You are here

function olivero_preprocess_search_result in Drupal 9

Implements hook_preprocess_search_result().

File

core/themes/olivero/olivero.theme, line 598
Functions to support theming in the Olivero theme.

Code

function olivero_preprocess_search_result(&$variables) {

  // 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');
  }
}