addAttributesToRender() public method

Adds attributes related to CSS styles to renderer.
public addAttributesToRender ( $writer )
Ejemplo n.º 1
0
 /**
  * Adds attributes related to CSS styles to renderer.
  * This method overrides the parent implementation.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 public function addAttributesToRender($writer)
 {
     if (($url = trim($this->getBackImageUrl())) !== '') {
         $this->setStyleField('background-image', 'url(' . $url . ')');
     }
     switch ($this->getScrollBars()) {
         case TScrollBars::Horizontal:
             $this->setStyleField('overflow-x', 'scroll');
             break;
         case TScrollBars::Vertical:
             $this->setStyleField('overflow-y', 'scroll');
             break;
         case TScrollBars::Both:
             $this->setStyleField('overflow', 'scroll');
             break;
         case TScrollBars::Auto:
             $this->setStyleField('overflow', 'auto');
             break;
     }
     if (($align = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) {
         $this->setStyleField('text-align', strtolower($align));
     }
     if (!$this->getWrap()) {
         $this->setStyleField('white-space', 'nowrap');
     }
     if (($direction = $this->getDirection()) !== TContentDirection::NotSet) {
         if ($direction === TContentDirection::LeftToRight) {
             $this->setStyleField('direction', 'ltr');
         } else {
             $this->setStyleField('direction', 'rtl');
         }
     }
     parent::addAttributesToRender($writer);
 }
Ejemplo n.º 2
0
 /**
  * Adds attributes related to CSS styles to renderer.
  * This method overrides the parent implementation.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 public function addAttributesToRender($writer)
 {
     if (!$this->getWrap()) {
         $writer->addStyleAttribute('white-space', 'nowrap');
     }
     if (($horizontalAlign = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) {
         $writer->addAttribute('align', strtolower($horizontalAlign));
     }
     if (($verticalAlign = $this->getVerticalAlign()) !== TVerticalAlign::NotSet) {
         $writer->addAttribute('valign', strtolower($verticalAlign));
     }
     parent::addAttributesToRender($writer);
 }
Ejemplo n.º 3
0
 /**
  * Adds attributes related to CSS styles to renderer.
  * This method overrides the parent implementation.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 public function addAttributesToRender($writer)
 {
     if (($url = trim($this->getBackImageUrl())) !== '') {
         $writer->addStyleAttribute('background-image', 'url(' . $url . ')');
     }
     if (($horizontalAlign = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) {
         $writer->addStyleAttribute('text-align', strtolower($horizontalAlign));
     }
     if (($cellPadding = $this->getCellPadding()) >= 0) {
         $writer->addAttribute('cellpadding', "{$cellPadding}");
     }
     if (($cellSpacing = $this->getCellSpacing()) >= 0) {
         $writer->addAttribute('cellspacing', "{$cellSpacing}");
     }
     if ($this->getBorderCollapse()) {
         $writer->addStyleAttribute('border-collapse', 'collapse');
     }
     switch ($this->getGridLines()) {
         case TTableGridLines::Horizontal:
             $writer->addAttribute('rules', 'rows');
             break;
         case TTableGridLines::Vertical:
             $writer->addAttribute('rules', 'cols');
             break;
         case TTableGridLines::Both:
             $writer->addAttribute('rules', 'all');
             break;
     }
     parent::addAttributesToRender($writer);
 }