function uikit_preprocess_menu_local_tasks

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

File

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

Code

function uikit_preprocess_menu_local_tasks(&$variables) {
  $primary_tasks_style = UIkit::getThemeSetting('primary_tasks_style');
  $secondary_tasks_style = UIkit::getThemeSetting('secondary_tasks_style');

  // Create new primary tasks attributes.
  $variables ['primary_attributes'] = new Attribute();
  $variables ['primary_attributes']['class'] = [];
  if ($primary_tasks_style == 'uk-tab') {
    // Add uk-tab class to primary tasks.
    $variables ['primary_attributes']['class'][] = 'uk-tab';
  }
  else {
    // Add uk-subnav class to primary tasks.
    $variables ['primary_attributes']['class'][] = 'uk-subnav';
    if ($primary_tasks_style) {
      // Add uk-subnav-* class to primary tasks.
      $variables ['primary_attributes']['class'][] = $primary_tasks_style;
    }
  }

  // Create new secondary tasks attributes.
  $variables ['secondary_attributes'] = new Attribute();
  $variables ['secondary_attributes']['class'] = ['uk-subnav'];
  if ($secondary_tasks_style) {
    // Add uk-subnav-* class to secondary tasks.
    $variables ['secondary_attributes']['class'][] = $secondary_tasks_style;
  }
}

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