You are here

function _site_map_front_page in Site map 8

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

Menu callback for the site map front page.

Return value

string Returns HTML string for front page site map.

1 call to _site_map_front_page()
template_preprocess_site_map in ./site_map.theme.inc
Preprocesses the variables for site-map.html.twig.

File

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

Code

function _site_map_front_page() {
  $config = \Drupal::config('site_map.settings');
  $class = array();
  $options = array();
  $title = t('Front page');
  $output = \Drupal::l(t('Front page of %sn', array(
    '%sn' => \Drupal::config('system.site')
      ->get('name'),
  )), Url::fromRoute('<front>', [], array(
    'html' => TRUE,
  )));
  if ($config
    ->get('show_rss_links') != 0) {
    $feed_icon = array(
      '#theme' => 'site_map_feed_icon',
      '#url' => $config
        ->get('rss_front'),
      '#name' => 'front page',
    );
    $rss_link = drupal_render($feed_icon);
    if (\Drupal::service('module_handler')
      ->moduleExists('commentrss') && \Drupal::config('commentrss.settings')
      ->get('commentrss_site')) {
      $feed_icon = array(
        '#theme' => 'site_map_feed_icon',
        '#url' => 'crss',
        '#type' => 'comment',
        '#name' => 'front page comments',
      );
      $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-front';
  $attributes = array(
    'class' => $class,
  );
  $site_map_box = array(
    '#theme' => 'site_map_box',
    '#title' => $title,
    '#content' => array(
      '#markup' => $output,
    ),
    '#attributes' => $attributes,
    '#options' => $options,
  );
  return $site_map_box;
}