X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=plekit%2Fphp%2Ftoggle.php;h=65e39969e663bfc92a121dbe845100011a0201ed;hb=781e3b93738314bab6e700f0cdb93a1cda316884;hp=897a8b893694ef6a4f394ba402882b7670b7fbd6;hpb=d19bb97d4d0fe68f64fc565d0351f9a2fa3854e6;p=plewww.git diff --git a/plekit/php/toggle.php b/plekit/php/toggle.php index 897a8b8..65e3996 100644 --- a/plekit/php/toggle.php +++ b/plekit/php/toggle.php @@ -20,10 +20,9 @@ drupal_set_html_head(' // (*) options: a hash that can define // - trigger-tagname : to be used instead of for wrapping the trigger // - bubble : might not work if trigger-tagname is redefined -// - init-hidden : start hidden rather than visible -// - info_div : the id of a 'div' element that contains a help text -// - info_text : the text for help on the tab -// - info_visible : whether info needs to be visible at startup +// - visible : if set to false, start hidden rather than visible +// - info-text : the text for help on the tab +// - info-visible : whether info needs to be visible at startup // // methods are as follows // (*) trigger_html (): return the html code for the trigger @@ -67,9 +66,23 @@ 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(); return $html; } + function visible_from_store_html() { + $id=$this->id; + $html = ""; + $html .= ""; + return $html; + } // create two images that get shown/hidden - could not find a better way to do it function image_html () { @@ -102,7 +115,7 @@ class PlekitToggle { $html .= $this->image_html(); $html .= $this->trigger; $html .= ""; - if (array_key_exists ('info_text',$this->options)) { + if (array_key_exists ('info-text',$this->options)) { $id=$this->id; $html .= "close info"; } @@ -111,14 +124,14 @@ class PlekitToggle { function info() { print $this->info_html();} function info_html () { - if (! array_key_exists ('info_text',$this->options)) return ""; + if (! array_key_exists ('info-text',$this->options)) return ""; // compute if info should be visible at startup // xxx in fact the default should be fetched in the browser storage xxx $info_visible=TRUE; - // if info_visible is set, use this value - if (array_key_exists ('info_visible',$this->options)) - $info_visible=$this->options['info_visible']; + // if info-visible is set, use this value + if (array_key_exists ('info-visible',$this->options)) + $info_visible=$this->options['info-visible']; $id=$this->id; $div_id=$this->id_name('info'); @@ -128,7 +141,7 @@ class PlekitToggle { if ($info_visible) $html .= " style='display:none'"; // tmp $html .= "
"; - $html .= $this->options['info_text']; + $html .= $this->options['info-text']; $html .= "toggle info"; $html .= "
"; return $html;