You are here

function om_maximenu_inline_style in OM Maximenu 6

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

OM Maximenu inline styling

2 calls to om_maximenu_inline_style()
om-maximenu-modal-content.tpl.php in tpl/om-maximenu-modal-content.tpl.php
om_maximenu_modal_content.tpl.php Default theme implementation of om maximenu contents with modal blocks
om-maximenu-wrapper.tpl.php in tpl/om-maximenu-wrapper.tpl.php
om_maximenu_wrapper.tpl.php Default theme implementation of om maximenu wrapper

File

inc/om_maximenu.utils.inc, line 179
OM Maximenu Admin Utilities

Code

function om_maximenu_inline_style($links = array()) {
  $out = '';
  if ($links['output'] == 'block') {

    // do nothing now, maybe in the future
  }
  elseif ($links['output'] == 'float') {

    // fixed/absolute
    $position = isset($links['float_options']['position']) && $links['float_options']['position'] == 'absolute' ? 'absolute' : 'fixed';

    // left/middle/right
    if (isset($links['float_options']['x_origin']) && $links['float_options']['x_origin'] != 'middle') {
      $x_origin = isset($links['float_options']['x_origin']) ? $links['float_options']['x_origin'] : 'left';
      $x_value = isset($links['float_options']['x_value']) ? $links['float_options']['x_value'] : 10;
      $x_px = $x_value != 0 ? 'px' : '';
      $x_prop = $x_origin . ': ' . $x_value . $x_px . '; ';
    }
    else {
      $x_prop = '';

      // jquery will determine the position
    }

    // top/bottom
    $y_origin = isset($links['float_options']['y_origin']) ? $links['float_options']['y_origin'] : 'bottom';
    $y_value = isset($links['float_options']['y_value']) ? $links['float_options']['y_value'] : 10;
    $y_px = $y_value != 0 ? 'px' : '';
    $y_prop = $y_origin . ': ' . $y_value . $y_px . '; ';
    $out = ' style="position: ' . $position . '; ' . $x_prop . $y_prop . '" ';
  }
  elseif ($links['output'] == 'main_menu') {

    // do nothing now, maybe in the future
  }
  return $out;
}