X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plekit%2Fphp%2Ftoggle.php;h=b481195ccf87e1c9e3252538ab2414a96bd841f5;hb=ab60f70071b4891d81c1ff41339604e154ec5b26;hp=ee0dc0cc49d243d4e85fbc3586eb80f4f5da583f;hpb=7d4971597397caa302b9caf5d38c016139ab5b00;p=plewww.git diff --git a/plekit/php/toggle.php b/plekit/php/toggle.php index ee0dc0c..b481195 100644 --- a/plekit/php/toggle.php +++ b/plekit/php/toggle.php @@ -41,9 +41,13 @@ class PlekitToggle { $this->id = $id; $this->trigger=$trigger; if ( ! $options ) $options = array(); + // 'visible' may be set or not; if set to NULL it's considered as undefined + // so using NULL as the default means 'select from local storage i.e. last status' + if (array_key_exists ('visible',$options) && $options['visible']==NULL) + unset ($options['visible']); + // start-hidden is internal and is always set if (array_key_exists ('visible',$options)) { $options['start-hidden'] = ! $options['visible']; - unset ($options['visible']); } if (!isset ($options['start-hidden'])) $options['start-hidden']=false; @@ -67,8 +71,9 @@ class PlekitToggle { $html = ""; $html .= $this->area_end_html(); $html .= $this->container_end(); - // turn or or off from local storage - $html .= $this->visible_from_store_html(); + // if 'visible' is not set, set or or off from local storage + if ( ! array_key_exists('visible',$this->options) ) + $html .= $this->visible_from_store_html(); return $html; } @@ -78,9 +83,9 @@ class PlekitToggle { $html .= ""; return $html; } @@ -111,14 +116,14 @@ class PlekitToggle { $html .= " id='$trigger_id'"; $html .= " class='plc-toggle-trigger'"; if ($bubble) $html .= " title='$bubble'"; - $html .= " onclick=\"plekit_toggle('$this->id')\""; + $html .= " onclick=\"pletoggle_toggle('$this->id')\""; $html .= ">"; $html .= $this->image_html(); $html .= $this->trigger; $html .= ""; if (array_key_exists ('info-text',$this->options)) { $id=$this->id; - $html .= "close info"; + $html .= "close info"; } return $html; } @@ -139,12 +144,12 @@ class PlekitToggle { $html=""; $html .= "
options['info-text']; - $html .= "toggle info"; + $html .= "toggle info"; $html .= "
"; return $html; }