protected function getCssAttributesToRender() { //ORDER OF THE SELECTORS IS IMPORTANT!!!!! //main menu selector and first un-ordered list $selector = new Selector($this->getID(), 'id'); $selector->addId($this->getID() . ' ul'); $selector->addStyle('list-style', 'none'); //list style $selector->addStyle('line-height', '1'); //this makes sure lines are 1em and not 1+. $borderWidth = $this->getBorderWidth(); if (strlen($borderWidth)) { $borderWidth = $this->formatTRBL($borderWidth); } $borderColor = $this->getBorderColor(); $borderStyle = $this->getBorderStyle(); $selector->addStyle('border', $borderWidth . ' ' . $borderStyle . ' ' . '#' . $borderColor); $padding = $this->getPadding(); if (strlen($padding)) { $selector->addStyle('padding', $this->formatTRBL($padding)); } $width = $this->getWidth(); if (strlen($width)) { if (is_numeric($width)) { $selector->addStyle('width', $width . 'em'); } else { $selector->addStyle('width', $width); } } $selector->addStyle('margin', '0'); //eliminate the margin $selector->addStyle('float', 'left'); $background = $this->getBackColor(); if (strlen($background)) { $selector->addStyle('background', '#' . $background); } $this->cssFile->addSelector($selector); //get the main navigation items width $headingWidth = $this->getHeadingWidth(); //main menu anchor $selector = new Selector($this->getID() . ' a', 'id'); $selector->addStyle('display', 'block'); if (strlen($headingWidth)) { $selector->addStyle('width', $headingWidth); } $textDecoration = $this->getTextDecoration(); if (strlen($textDecoration)) { $selector->addStyle('text-decoration', $textDecoration); } $color = $this->getForeColor(); if (strlen($color)) { $selector->addStyle('color', '#' . $color); } $fontWeight = $this->getFontWeight(); if (strlen($fontWeight)) { $selector->addStyle('font-weight', $fontWeight); } $this->cssFile->addSelector($selector); //main menu li //width is for opera $selector = new Selector($this->getID() . ' li', 'id'); $selector->addStyle('float', 'left'); if (strlen($headingWidth)) { $selector->addStyle('width', $headingWidth); } //$selector->addStyle('float','left'); $this->cssFile->addSelector($selector); //hide the third list $selector = new Selector($this->getID() . ' li:hover ul ul', 'id'); $selector->addId($this->getID() . ' li:hover ul ul ul'); $selector->addId($this->getID() . ' li.sfhover ul ul'); $selector->addId($this->getID() . ' li.sfhover ul ul ul'); $selector->addStyle('left', '-999' . 'em'); $this->cssFile->addSelector($selector); //unhide the second list $selector = new Selector($this->getID() . ' li:hover ul', 'id'); $selector->addId($this->getID() . ' li li:hover ul', 'id'); $selector->addId($this->getID() . ' li li li:hover ul'); $selector->addId($this->getID() . ' li.sfhover ul'); $selector->addId($this->getID() . ' li li.sfhover ul'); $selector->addId($this->getID() . ' li li li.sfhover ul'); $selector->addStyle('left', 'auto'); $this->cssFile->addSelector($selector); }
protected function getCssAttributesToRender() { $subMenuWidth = $this->getSubMenuWidth(); $selector = new Selector($this->getID() . ' ul', 'id'); $selector->addStyle('position', 'absolute'); $selector->addStyle('left', '-999' . 'em'); if (strlen($subMenuWidth)) { if (is_numeric($subMenuWidth)) { $selector->addStyle('width', $subMenuWidth . 'em'); } else { $selector->addStyle('width', $subMenuWidth); } } $borderWidth = $this->getBorderWidth(); $topBorder = -1; if (strlen($borderWidth)) { if (!stripos($borderWidth, 'px')) { if (is_numeric($borderWidth)) { $topBorder -= $borderWidth; } else { $topBorder -= rtrim($borderWidth, 'em'); } } } $borderWidth = $this->getBorderWidth(); if (!strlen($borderWidth)) { $borderWidth = '0px'; } $borderColor = $this->getBorderColor(); if (strlen($borderColor)) { $borderColor = '#' . $borderColor; } $borderStyle = $this->getBorderStyle(); $selector->addStyle('border', $borderWidth . ' ' . $borderStyle . ' ' . $borderColor); $selector->addStyle('height', 'auto'); $selector->setLevel($this->getLevel()); $background = $this->getSubMenuBackColor(); if (strlen($background)) { $selector->addStyle('background', '#' . $background); } $this->cssFile->addSelector($selector); //position the third lists on down $selector = new Selector($this->getID() . ' li ul', 'id'); if (strlen($subMenuWidth)) { $selector->addStyle('margin', $topBorder . 'em 0 0 ' . $subMenuWidth); } $selector->setLevel($this->getLevel()); $this->cssFile->addSelector($selector); $selector = new Selector($this->getID() . ' ul a', 'id'); if (strlen($subMenuWidth)) { if (is_numeric($subMenuWidth)) { $selector->addStyle('width', $subMenuWidth . 'em'); } else { $selector->addStyle('width', $subMenuWidth); } } $selector->setLevel($this->getLevel()); $this->cssFile->addSelector($selector); $selector = new Selector($this->getID() . 'A', 'id'); $background = $this->getBackColor(); if (strlen($background)) { $selector->addStyle('background', '#' . $background . ' !important'); } $color = $this->getForeColor(); if (strlen($color)) { $selector->addStyle('color', '#' . $color); } $enabled = $this->isEnabled(); if (!$enabled) { $selector->addStyle('font-weight', 'lighter !important'); } $padding = $this->getPadding(); if (strlen($padding)) { $selector->addStyle('padding', $padding); } $fontWeight = $this->getFontWeight(); if (strlen($fontWeight) && $this->isEnabled()) { $selector->addStyle('font-weight', $fontWeight); } $selector->setLevel($this->getLevel()); $this->cssFile->addSelector($selector); $selector = new Selector($this->getID() . ' :hover', 'id'); $color = $this->getHoverColor(); if (strlen($color)) { $selector->addStyle('color', '#' . $color . ' !important'); } $background = $this->getHoverBack(); if (strlen($background)) { $selector->addStyle('background', '#' . $background . ' !important'); } $selector->setLevel($this->getLevel()); $this->cssFile->addSelector($selector); $selector = new Selector($this->getID(), 'id'); $selector->setLevel($this->getLevel()); $this->cssFile->addSelector($selector); }