You are here

function template_preprocess_om_maximenu_roundabout_links in OM Maximenu 6

Same name and namespace in other branches
  1. 8 inc/om_maximenu.render.inc \template_preprocess_om_maximenu_roundabout_links()
  2. 7 inc/om_maximenu.render.inc \template_preprocess_om_maximenu_roundabout_links()

Process variables for om_maximenu_roundabout_links.tpl.php

File

inc/om_maximenu.render.inc, line 784
OM Maximenu Render

Code

function template_preprocess_om_maximenu_roundabout_links(&$vars) {
  $content = $vars['content'];

  // user roles and permissions
  $vars['permission'] = om_maximenu_link_visible($vars['content']['roles']);

  // php on title
  if (isset($content['php_option']) && $content['php_option'] == 1) {
    ob_start();
    $content['link_title'] = eval($content['link_title']);

    //$output = ob_get_contents();
    ob_end_clean();
  }

  // span id
  $span_id = !empty($content['id']) ? ' id="' . om_string_name($content['id']) . '"' : '';

  // span title
  $span_title = !empty($content['description']) && $content['description_option'] == 'hover' ? 'title="' . check_plain($content['description']) . '"' : '';

  // link content
  $link_option = om_maximenu_link_option($content);

  // a link attributes
  $attributes = om_maximenu_link_attrib($content);

  // title with javascript should have div tag
  $script_link = om_string_name($content['link_title'], FALSE);

  // title contains some block elements
  $link_tag = isset($content['php_option']) && $content['php_option'] == 1 || $script_link == 'Script Link' ? 'div' : 'span';

  // useful when you just want a button for getting the content to show and not actually linking to anything
  $vars['om_link'] = '<' . $link_tag . $span_id . ' class="' . $attributes['class'] . '" ' . $span_title . '>' . $link_option . '</' . $link_tag . '>';
  $vars['template_files'][] = 'om-maximenu-roundabout-links__' . $vars['maximenu_name'];
  $vars['template_files'][] = 'om-maximenu-roundabout-links__' . $vars['maximenu_name'] . '-' . $vars['key'];
  $vars['template_files'][] = 'om-maximenu-roundabout-links__' . om_string_name($content['link_title']);
}