
Public Member Functions | |
| getLinks () | |
| addLink ($label, $url='', $title='', $prepare=false, $urlParams=array(), $position=null, $liParams=null, $aParams=null, $beforeText='', $afterText='') | |
| removeLinkByUrl ($url) | |
Protected Member Functions | |
| _construct () | |
| _prepareParams ($params) | |
| _beforeToHtml () | |
Protected Attributes | |
| $_links = array() | |
Definition at line 35 of file Links.php.
| _beforeToHtml | ( | ) | [protected] |
Set first/last
Reimplemented from Mage_Core_Block_Abstract.
Definition at line 154 of file Links.php.
00155 { 00156 if (!empty($this->_links)) { 00157 reset($this->_links); 00158 $this->_links[key($this->_links)]->setIsFirst(true); 00159 end($this->_links); 00160 $this->_links[key($this->_links)]->setIsLast(true); 00161 } 00162 return parent::_beforeToHtml(); 00163 }
| _construct | ( | ) | [protected] |
Set default template
Reimplemented from Mage_Core_Block_Abstract.
Definition at line 49 of file Links.php.
| _prepareParams | ( | $ | params | ) | [protected] |
Prepare tag attributes
| string|array | $params |
Definition at line 135 of file Links.php.
00136 { 00137 if (is_string($params)) { 00138 return $params; 00139 } elseif (is_array($params)) { 00140 $result = ''; 00141 foreach ($params as $key=>$value) { 00142 $result .= ' ' . $key . '="' . addslashes($value) . '"'; 00143 } 00144 return $result; 00145 } 00146 return ''; 00147 }
| addLink | ( | $ | label, | |
| $ | url = '', |
|||
| $ | title = '', |
|||
| $ | prepare = false, |
|||
| $ | urlParams = array(), |
|||
| $ | position = null, |
|||
| $ | liParams = null, |
|||
| $ | aParams = null, |
|||
| $ | beforeText = '', |
|||
| $ | afterText = '' | |||
| ) |
Add link to the list
| string | $label | |
| string | $url | |
| string | $title | |
| boolean | $prepare | |
| array | $urlParams | |
| int | $position | |
| string|array | $liParams | |
| string|array | $aParams | |
| string | $beforeText | |
| string | $afterText |
Definition at line 79 of file Links.php.
00081 { 00082 if (is_null($label) || false===$label) { 00083 return $this; 00084 } 00085 $link = new Varien_Object(array( 00086 'label' => $label, 00087 'url' => ($prepare ? $this->getUrl($url, (is_array($urlParams) ? $urlParams : array())) : $url), 00088 'title' => $title, 00089 'li_params' => $this->_prepareParams($liParams), 00090 'a_params' => $this->_prepareParams($aParams), 00091 'before_text' => $beforeText, 00092 'after_text' => $afterText, 00093 )); 00094 00095 if (intval($position) > 0) { 00096 while (isset($this->_links[$position])) { 00097 $position++; 00098 } 00099 $this->_links[$position] = $link; 00100 ksort($this->_links); 00101 } else { 00102 $position = 0; 00103 foreach ($this->_links as $k=>$v) { 00104 $position = $k; 00105 } 00106 $this->_links[$position+10] = $link; 00107 } 00108 00109 return $this; 00110 }
| getLinks | ( | ) |
| removeLinkByUrl | ( | $ | url | ) |
Removes link by url
| string | $url |
Definition at line 118 of file Links.php.
00119 { 00120 foreach ($this->_links as $k => $v) { 00121 if ($v->getUrl() == $url) { 00122 unset($this->_links[$k]); 00123 } 00124 } 00125 00126 return $this; 00127 }
1.5.8