paint(); } /** * Sets the CSS class to use. Use ":swap:" to alternate * * @param string CSS class * * @return fluent interface */ public function setCssClass($class) { $this->cssClass = $class; return $this; } /** * Sets the style information * * @param array Style attributes * * @return fluent interface */ public function setStyle(Array $attributes) { $this->style = $attributes; return $this; } /** * Sets the DOM/CSS ID of the element * * @param string The ID * * @return fluent interface */ public function setId($id) { $this->id = $id; return $this; } /** * Returns a string of style attributes, that include id, style, and class * * @return string Style attributes */ protected function _prepareStyle() { if (empty($this->style) && empty($this->cssClass) && empty($this->id)) { return; } if ($this->cssClass == ':swap:') { BSFunctions::swap_css_classes(); $class = BSFunctions::$cssClass; } else { $class = $this->cssClass; } $attrs = array(); foreach ($this->style as $prop => $value) { $attrs[] = $prop . ': ' . $value; } $style = implode('; ', $attrs); $string = ''; if ($class) { $string .= ' class="' . $class . '"'; } if ($style) { $string .= ' style="' . $style . '"'; } if ($this->id) { $string .= ' id="' . $this->id . '"'; } return $string; } } ?>