Add the ability to set the id attribute of all Printer elements
[isso.git] / PrinterAbstract.php
index e8ad7d3c4d54e6b98e50f0f2951d4b32c057eaa7..08a91abe62b685b42bd161f347c62c78b68f15ae 100644 (file)
@@ -50,6 +50,12 @@ abstract class BSPrinterAbstract
         */
        protected $cssClass = ':swap:';
        
+       /**
+        * DOM ID of the element
+        * @var string
+        */
+       protected $id;
+       
        /**
         * Fluent object instantiation
         */
@@ -86,6 +92,17 @@ abstract class BSPrinterAbstract
                return $this;
        }
        
+       /**
+        * Sets the DOM/CSS ID of the element
+        *
+        * @param       string  The ID
+        */
+       public function setId($id)
+       {
+               $this->id = $id;
+               return $this;
+       }
+       
        /**
         * Returns a string of CSS style attributes
         *
@@ -93,7 +110,7 @@ abstract class BSPrinterAbstract
         */
        protected function _prepareStyle()
        {
-               if (empty($this->style) && empty($this->cssClass))
+               if (empty($this->style) && empty($this->cssClass) && empty($this->id))
                {
                        return;
                }
@@ -126,6 +143,10 @@ abstract class BSPrinterAbstract
                {
                        $string .= ' style="' . $style . '"';
                }
+               if ($this->id)
+               {
+                       $string .= ' id="' . $this->id . '"';
+               }
                
                return $string;
        }