0
Welcome Guest! Login
0 items Join Now

SOLVED splitmenu selectbox, when drop down is active

  • Re: SOLVED splitmenu selectbox, when drop down is active

    Posted 6 years 7 months ago
    • For the records, this is how I fixed the layouts.php

      I basically added a template variable in template-options.xml
       <field name="template-menu" type="hidden" default='1' />

      <template>/html/mod_roknavmenu/themes/gantry-splitmenu/theme.php
      <template>/html/mod_roknavmenu/themes/gantry-dropdown/theme.php
       protected $defaults = array(
              'template-menu' => '0',
              'enable_current_id' => 0,
              // ...

      <template>/html/mod_roknavmenu/themes/gantry-dropdown/layout.php
      public function renderMenu(&$menu)
      {
          ob_start();
      
          if (isset($this->args['template-menu']) && $this->args['template-menu'] == '1'): ?>
              <div class="gf-menu-device-container responsive-type-<?php echo $this->args['responsive-menu']; ?>"></div>
          <?php endif; ?>
          <ul class="gf-menu <?php echo $this->args['class_sfx']; ?> l1"
            <?php if (array_key_exists('tag_id', $this->args)): ?>id="<?php echo $this->args['tag_id']; ?>"<?php endif; ?>>
            <?php foreach ($menu->getChildren() as $item) : ?>
          	  <?php $this->renderItem($item, $menu); ?>
            <?php endforeach; ?>
          </ul>
      <?php
          return ob_get_clean();
      }

      <template>/html/mod_roknavmenu/themes/gantry-splitmenu/layout.php
      public function renderMenu(&$menu)
      {
          ob_start();
          $menuname = (isset($this->args['template-menu']) && $this->args['template-menu'] == '1') ? 'gf-menu gf-splitmenu' : 'menu';
          ?>
      
          <?php // this if is probably wrong -> further tests required
            if ($menu->getChildren()) : ?>
              <?php if (isset($this->args['template-menu']) && $this->args['template-menu'] == '1'): ?>
                  <div class="gf-menu-device-container responsive-type-<?php echo $this->args['responsive-menu']; ?>"></div>
              <?php endif;
                 // class_sfx is the class suffix, so it must be appended to the original class ?>
              <ul class="<?php echo $menuname; ?><?php echo $this->args['class_sfx']; ?> l1"
                <?php if (array_key_exists('tag_id', $this->args)): ?>id="<?php echo $this->args['tag_id']; ?>"<?php endif; ?>>
                <?php foreach ($menu->getChildren() as $item) : ?>
              	  <?php $this->renderItem($item, $menu); ?>
                <?php endforeach; ?>
              </ul>
          <?php endif; 
          
          return ob_get_clean();
      }
    • The following users have thanked you: Matt

  • Re: SOLVED splitmenu selectbox, when drop down is active

    Posted 6 years 7 months ago
    • Sorry, for the splitmenu that still was not quite correct.


      public function renderMenu(&$menu)
      {
          ob_start();
          
          $menuname =  'menu';
          $sfxClass = isset($this->args['submenu-class_sfx']) ? $this->args['submenu-class_sfx'] : '';
          
          
          if( $menu->getChildren() ) : // do not output anything if menu has no elements
          
              // only if template menu is active, activate the top main layout and the responsive version
              if( isset($this->args['template-menu']) && $this->args['template-menu'] == '1' &&
                isset($this->args['style']) && $this->args['style'] == 'mainmenu'){
              
                  $menuname =  'gf-menu gf-splitmenu';
                  $sfxClass = isset($this->args['mainmenu-class_sfx']) ? 
                      $this->args['mainmenu-class_sfx'] : '';
                  ?><div class="gf-menu-device-container responsive-type-<?php 
                      echo $this->args['responsive-menu'];?>"></div>
                  <?php
              }
              
              // class_sfx is the class suffix, so it must be appended to the original class ?>
              <ul class="<?php echo $menuname; ?><?php echo $sfxClass; ?> l1"
                <?php if (array_key_exists('tag_id', $this->args)): 
                  ?>id="<?php echo $this->args['tag_id']; ?>"       <?php endif; ?>>
              <?php foreach ($menu->getChildren() as $item) : ?>
                <?php $this->renderItem($item, $menu); ?>
              <?php endforeach; ?>
              </ul>
              <?php endif; // ( $menu->getChildren() )
          
          return ob_get_clean();
      }

Time to create page: 0.039 seconds