function olivero_preprocess_search_result

Same name in other branches
  1. 9 core/themes/olivero/olivero.theme \olivero_preprocess_search_result()
  2. 11.x core/themes/olivero/olivero.theme \olivero_preprocess_search_result()

Implements hook_preprocess_search_result().

File

core/themes/olivero/olivero.theme, line 575

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.