X-Git-Url: https://git.llucax.com/mecon/meconlib.git/blobdiff_plain/43bd40b6445e74534133d1080dd6ba2dcdab579a..7eddd945e06d40240c52993be71ad52b9212f79e:/lib/MECON/HTML/Icon.php diff --git a/lib/MECON/HTML/Icon.php b/lib/MECON/HTML/Icon.php index 82b1764..26f20f6 100644 --- a/lib/MECON/HTML/Icon.php +++ b/lib/MECON/HTML/Icon.php @@ -60,6 +60,12 @@ class MECON_HTML_Icon extends MECON_HTML_Image { */ var $_link; + /** + * Alineacion de la imagen con respecto al texto. + * @private + */ + var $_align; + /** * Constructor. * @@ -68,8 +74,10 @@ class MECON_HTML_Icon extends MECON_HTML_Image { Puede ser un link o un MECON_HTML_Link. * @param $alt Texto alternativo para la imagen. * @param $attrs Atributos de la imágen. + * @param $align Alineación de la imagen con respecto al texto. */ - function MECON_HTML_Icon($nombre, $link = null, $alt = null, $attrs = array()) + function MECON_HTML_Icon($nombre, $link = null, $alt = null, $attrs = + array(), $align = 'right') { switch ($nombre) { default: @@ -80,6 +88,7 @@ class MECON_HTML_Icon extends MECON_HTML_Image { } parent::MECON_HTML_Image($src, $alt, $attrs); $this->setLink($link); + $this->_align = $align; } /** @@ -148,8 +157,15 @@ class MECON_HTML_Icon extends MECON_HTML_Image { if (!$full or is_null($link)) { return $link; } - $link->addContents(new MECON_HTML_Image($this->getSrc(), - $this->getAlt(), $this->getAttributes())); + + if ($this->_align == 'left') { + $link->addContents(new MECON_HTML_Image($this->getSrc(), + $this->getAlt(), $this->getAttributes()), true); + } + elseif ($this->_align == 'right') { + $link->addContents(new MECON_HTML_Image($this->getSrc(), + $this->getAlt(), $this->getAttributes())); + } return $link; }