You are here

function mmenu_add_css in Mobile sliding menu 7.2

Same name and namespace in other branches
  1. 7.3 mmenu.module \mmenu_add_css()
  2. 7 mmenu.module \mmenu_add_css()

Generates the mmenu css list and adds to Drupal.

Parameters

array $mmenu: An associative array of a mmenu.

1 call to mmenu_add_css()
template_preprocess_mmenu in ./mmenu.module
Processes variables for mmenu.tpl.php.

File

./mmenu.module, line 832
Primarily Drupal hooks and global API functions to manipulate mmenus.

Code

function mmenu_add_css(array $mmenu) {

  // Uses custom css if it is set.
  if (isset($mmenu['custom']['css'])) {
    foreach ($mmenu['custom']['css'] as $css) {
      drupal_add_css($css, array(
        'group' => CSS_DEFAULT,
        'weight' => 100,
      ));
    }
    return;
  }

  // Adds mmenu theme styles.
  if (isset($mmenu['options']['classes'])) {
    $themes = explode(' ', $mmenu['options']['classes']);
    foreach ($themes as $theme) {
      $mmenu_theme = mmenu_theme_list($theme);
      if (isset($mmenu_theme['css'])) {
        foreach ($mmenu_theme['css'] as $css) {
          drupal_add_css($css, array(
            'group' => CSS_DEFAULT,
            'weight' => 100,
          ));
        }
      }
    }
  }

  // Adds mmenu effect styles.
  if (isset($mmenu['options']['effects'])) {
    foreach ($mmenu['options']['effects'] as $k => $v) {
      $mmenu_effect = mmenu_effect_list($k);
      if (isset($mmenu_effect['css'])) {
        foreach ($mmenu_effect['css'] as $css) {
          drupal_add_css($css, array(
            'group' => CSS_DEFAULT,
            'weight' => 100,
          ));
        }
      }
    }
  }
}