0
Welcome Guest! Login
0 items Join Now

weird logic in GantryFeaturelogo of template override

  • weird logic in GantryFeaturelogo of template override

    Posted 6 years 8 months ago
    • Hi there,

      when examing the feature override of the default gantry template, I wonder what that logic is good for:
      class GantryFeaturelogo extends GantryFeature {
          var $_feature_name = 'logo';
      
          function isEnabled() {
              
              global $gantry;
              if (!isset($gantry->browser)) return $this->get('enabled');
              if ($gantry->browser->platform != 'iphone' && $gantry->browser->platform != 'android') return $this->get('enabled');
      
              $prefix = $gantry->get('template_prefix');
              $cookiename = $prefix.$gantry->browser->platform.'-switcher';
              $cookie = $gantry->retrieveTemp('platform', $cookiename);
      
              if ($cookie == 1 && $gantry->get($gantry->browser->platform.'-enabled')) return true;
              return $this->get('enabled');
          }
      }
      From my point of view does it always return the slider setting of the template back-end. The only exception is in case the slider is set to off: it will override that to true if
      • the platform is mobile (android or iphone)
      • the specific cookie is set
      • and those mobile platforms are enabled.

      My questions
      • When is the cookie set?
      • Where is specified if the brwoser platform is enabled?
      • Why is it important to override the slider setting in that particular case?
      • I assume the intended logic has been something different. But what?
    • Last Edit: 6 years 8 months ago by Christoph Hagedorn.
    • Damir's Avatar
    • Damir
    • Preeminent Rocketeer
    • Posts: 22450
    • Thanks: 2679
    • Web Developer

    Re: weird logic in GantryFeaturelogo of template override

    Posted 6 years 8 months ago

Time to create page: 0.039 seconds