Source for file BoolToCSS.php

Documentation is available at BoolToCSS.php

  1. <?php
  2.  
  3. /**
  4.  * Pre-transform that changes converts a boolean attribute to fixed CSS
  5.  */
  6.     
  7.     /**
  8.      * Name of boolean attribute that is trigger
  9.      */
  10.     protected $attr;
  11.     
  12.     /**
  13.      * CSS declarations to add to style, needs trailing semicolon
  14.      */
  15.     protected $css;
  16.     
  17.     /**
  18.      * @param $attr string attribute name to convert from
  19.      * @param $css string CSS declarations to add to style (needs semicolon)
  20.      */
  21.     public function __construct($attr$css{
  22.         $this->attr = $attr;
  23.         $this->css  = $css;
  24.     }
  25.     
  26.     public function transform($attr$config$context{
  27.         if (!isset($attr[$this->attr])) return $attr;
  28.         unset($attr[$this->attr]);
  29.         $this->prependCSS($attr$this->css);
  30.         return $attr;
  31.     }
  32.     
  33. }

Documentation generated on Thu, 19 Jun 2008 18:48:53 -0400 by phpDocumentor 1.4.2