/** * @group ZF-11876 */ public function testRenderingWithCustomHtmlAttribs() { $container = new Zend_Navigation(array(array('label' => 'Page 1', 'uri' => 'p1', 'customHtmlAttribs' => array('rel' => 'nofollow', 'style' => 'font-weight: bold;'), 'pages' => array(array('label' => 'Page 2', 'uri' => 'p2', 'customHtmlAttribs' => array('rel' => 'nofollow'), 'pages' => array(array('label' => 'Page 3', 'uri' => 'p3', 'active' => true))))))); $expected = '<a href="p1" rel="nofollow" style="font-weight: bold;">Page 1</a>' . ' > ' . '<a href="p2" rel="nofollow">Page 2</a>' . ' > ' . 'Page 3'; $actual = $this->_helper->setMinDepth(0)->render($container); $this->assertEquals($expected, $actual); }
public function testLastBreadcrumbShouldBeEscaped() { $container = new Zend_Navigation(array(array('label' => 'Live & Learn', 'uri' => '#', 'active' => true))); $expected = 'Live & Learn'; $actual = $this->_helper->setMinDepth(0)->render($container); $this->assertEquals($expected, $actual); }
/** * Rendert den kompletten Breadcrumbs Pfad für die aktuelle Seite. * * @param Zend_Navigation_Container $container * @return string */ public function renderStraight(Zend_Navigation_Container $container = null) { if (null === $container) { $container = $this->getContainer(); } $active = $this->findActive($container, 0); if ($active) { $page = $active['page']; $helpPage = $page->helpUrl; } else { $helpPage = null; } $html = '<div class="breadcrumbsContainer"><div class="wrapper">'; if (!is_null($helpPage)) { $title = $this->view->translate('page-help-link-title'); $iconUrl = $this->view->layoutPath() . '/img/theme/admin/ic_help.png'; $pageUrl = $helpPage; // TODO evtl. baseUrl verwenden und helpUrl durch helpUri ersetzen $html .= '<a href="' . $pageUrl . '" class="admin-help" target="_blank"><img src="' . $iconUrl . '" width="25" height="20" alt="' . $title . '" title="' . $title . '"/></a>'; } if (is_null($this->replacement)) { $html .= parent::renderStraight($container); } else { $html .= $this->replacement; } if (!is_null($this->suffix)) { if ($this->suffixSeparatorDisabled !== true) { $html .= $this->getSeparator(); } $html .= $this->suffix; } $html .= '</div></div>'; return strlen($html) ? $this->getIndent() . $html : ''; }
public function breadcrumb(Zend_Navigation_Container $container = null) { $this->setSeparator('/'); return parent::breadcrumbs($container); }