function uikit_preprocess_breadcrumb

8.x-3.x preprocess.inc uikit_preprocess_breadcrumb(&$variables)
8.x-2.x preprocess.inc uikit_preprocess_breadcrumb(&$variables)
7.x-3.x preprocess.inc uikit_preprocess_breadcrumb(&$variables)
7.x-2.x preprocess.inc uikit_preprocess_breadcrumb(&$variables)

File

includes/preprocess.inc, line 187
Set up variables to be placed within the template (.html.twig) files.

Code

function uikit_preprocess_breadcrumb(&$variables) {
  // Add bool variable for breadcrumb display.
  $variables ['display_breadcrumbs'] = UIkit::getThemeSetting('display_breadcrumbs');

  // Remove "Home" breadcrumb if disabled in the theme settings.
  $breadcrumb_home_link = UIkit::getThemeSetting('breakcrumbs_home_link');
  if (!$breadcrumb_home_link) {
    array_shift($variables ['breadcrumb']);
  }

  if (UIkit::getThemeSetting('breakcrumbs_current_page')) {
    foreach ($variables ['breadcrumb'] as $key => $breadcrumb) {
      // Set all other items as not being active.
      $variables ['breadcrumb'][$key]['active'] = FALSE;
    }

    // Display the current page title if enabled in the theme settings and set
    // it as being active.
    $page_title = UIkit::getPageTitle();
    $variables ['breadcrumb'][] = [
      'text' => $page_title,
      'active' => TRUE,
    ];
  }
}

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Log in