You are here

function olivero_preprocess_search_result in Drupal 10

Same name and namespace in other branches
  1. 9 core/themes/olivero/olivero.theme \olivero_preprocess_search_result()

Implements hook_preprocess_search_result().

File

core/themes/olivero/olivero.theme, line 575
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');
  }
}