/** * Strategy pattern: Initialize the configuration. * * Change the head link elements of the web page according the configuration * pararmeters * * See {@link \Zend_View} * See {@link \Zend_View_Helper_HeadTitle} * * @param \Zend_Controller_Request_Abstract $request */ public function init(\Zend_Controller_Request_Abstract $request) { $this->_headLink = $this->_getView()->headLink(); foreach ($this->_options as $headLinkId => $options) { $placement = $this->parsePlacement($options['placement'], true); unset($options['placement']); if (!isset($options['rel'])) { require_once 'Exception.php'; throw new Exception('The definition of a HEAD LINK element require at least one minimum option parameter:\\"rel\\"'); } if (is_int($placement)) { $this->_headLink->offsetSet($placement, $this->_headLink->createData($options)); } else { $this->_headLink->headLink($options, $placement); } } }
public function getHeadLink() { if ($this->_headLink === null) { $this->_headLink = $this->_getView()->headLink(); $headLinksDefs = $this->getOptions(); foreach ($headLinksDefs as $headLinkId => $options) { $placement = $this->parsePlacement($options['placement'], true); unset($options['placement']); if (!isset($options['rel'])) { require_once 'Exception.php'; throw new Exception('The definition of a HEAD LINK element require at least one minimum option parameter:\\"rel\\"'); } if (is_int($placement)) { $this->_headLink->offsetSet($placement, $this->_headLink->createData($options)); } else { $this->_headLink->headLink($options, $placement); } } } return $this->_headLink; }