You are here

function _site_map_audio in Site map 8

Same name and namespace in other branches
  1. 5 site_map.module \_site_map_audio()
  2. 6.2 site_map.module \_site_map_audio()
  3. 6 site_map.module \_site_map_audio()
  4. 7 site_map.module \_site_map_audio()

Render the latest maps for audio.

Return value

string Returns HTML string of site map for audio.

File

./site_map.module, line 220
Provides a site map functionality.

Code

function _site_map_audio() {
  $config = \Drupal::config('site_map.settings');
  $output = '';
  $class = array();
  $options = array();
  if (\Drupal::service('module_handler')
    ->moduleExists('audio')) {
    $title = t('Audio');
    $output = \Drupal::l(t('Audio content'), Url::fromUri('base://' . 'audio'));
    if ($config
      ->get('show_rss_links') != 0) {
      $feed_icon = array(
        '#theme' => 'site_map_feed_icon',
        '#url' => 'audio/feed',
        '#name' => 'audio content',
      );
      $rss_link = drupal_render($feed_icon);
      if ($config
        ->get('show_rss_links') == 1) {
        $output .= ' ' . $rss_link;
      }
      else {
        $class[] = 'site-map-rss-left';
        $output = $rss_link . ' ' . $output;
      }
    }
    \Drupal::service('site_map.helper')
      ->setOption($options, 'show_titles', 1, 'show_titles', TRUE);
    $class[] = 'site-map-box-audio';
    $attributes = array(
      'class' => $class,
    );
    $site_map_box = array(
      '#theme' => 'site_map_box',
      '#title' => $title,
      '#content' => $output,
      '#attributes' => $attributes,
      '#options' => $options,
    );
    $output = drupal_render($site_map_box);
  }
  return $output;
}