Beispiel #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);
 }
Beispiel #2
0
 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);
 }