<?php


/**
 * Preprocess for buy_tickets_header().
 *
 * @param array $vars
 *   Theme variables.
 */
function toc_sr_preprocess_buy_tickets_header(array &$vars) {
  // Disable Live Departures
  $vars['ld_search'] = False;
  // Enable Check Service and Next Train forms.
  $vars['check_service_form'] = $vars['check_service'] ?? NULL;
  $vars['next_train_form'] = $vars['next_train'] ?? NULL;
}


/**
 * Preprocess for page_banner_random().
 */
function toc_sr_preprocess_page_banner_random(array &$vars) {
  // Use the original image size for the bookend style banner overlay.
  $overlay_image_mid = $vars['element']['config']['overlay_image'] ?? 0;
  if ($overlay_image_mid) {
    $overlay_image = _tm_misc_get_styled_images_from_media($overlay_image_mid, '', 'field_media_image', 'media', 'image', 'poly-over crsl-img');
    if ($overlay_image) {
      $vars['element']['overlay'] = $overlay_image;
    }
  }
}
