<?php

/**
 * @file
 */

/**
 *
 */
function toc_emr_station_info_accordion_alter(&$accordion, $entity, $vars = []) {

  $accordion['wrapper_class'] = 'acw-a alt mb-3';
  $accordion['items'] = [];

  $accordion['items'][] = [
    'pid' => 'station_info_accordion',
    'aiid' => 'general_info',
    'label' => '<i class="far fa-volume-up"></i> General information',
    'content' => _tm_nre_station_accordion_content_general_info($entity),
  ];

  // Station performance figures.
  if (\Drupal::moduleHandler()->moduleExists('station_performance_figures')) {
    $accordion_content = _tm_nre_station_accordion_content_performance($entity, $vars);
    if (!empty($accordion_content)) {
      $accordion['items'][] = [
        'pid' => 'station_info_accordion',
        'aiid' => 'performance',
        'label' => '<i class="far fa-tachometer-alt"></i> Performance',
        'content' => $accordion_content,
      ];
    }
  }

  $accordion['items'][] = [
    'pid' => 'station_info_accordion',
    'aiid' => 'fares',
    'label' => '<i class="far fa-ticket-alt"></i> Ticket buying and collection',
    'content' => _toc_emr_nre_station_accordion_content_fares($entity),
  ];
  $accordion['items'][] = [
    'pid' => 'station_info_accordion',
    'aiid' => 'passenger_services',
    'label' => '<i class="far fa-suitcase"></i> Passenger services',
    'content' => _toc_emr_nre_station_accordion_content_passenger_services($entity),
  ];
  $accordion['items'][] = [
    'pid' => 'station_info_accordion',
    'aiid' => 'station_facilities',
    'label' => '<i class="far fa-coffee"></i> Station facilities',
    'content' => _toc_emr_nre_station_accordion_content_station_facilities($entity),
  ];
  $accordion['items'][] = [
    'pid' => 'station_info_accordion',
    'aiid' => 'accessibility',
    'label' => '<i class="far fa-wheelchair"></i> Accessibility',
    'content' => _toc_emr_nre_station_accordion_content_accessibility($entity),
  ];
  $accordion['items'][] = [
    'pid' => 'station_info_accordion',
    'aiid' => 'interchange',
    'label' => '<i class="far fa-bus"></i> Interchange',
    'content' => _toc_nre_station_accordion_content_interchange($entity),
  ];

}
