Skip to content
Permalink
Browse files

`BreadcrumbsHelper::render()` returns null with no crumbs

  • Loading branch information...
mirko-pagliai committed Nov 26, 2016
1 parent f78ed4c commit dc14d4761520c52a9946863eba2e61cba7dafc6c
Showing with 7 additions and 1 deletion.
  1. +5 −1 src/View/Helper/BreadcrumbsHelper.php
  2. +2 −0 tests/TestCase/View/Helper/BreadcrumbsHelperTest.php
@@ -235,10 +235,14 @@ public function getCrumbs()
* - *innerAttrs* To provide attributes in case your separator is divided in two elements.
* All other properties will be converted as HTML attributes and will replace the *attrs* key in the template.
* If you use the default for this option (empty), it will not render a separator.
* @return string The breadcrumbs trail
* @return string|null The breadcrumbs trail
*/
public function render(array $attributes = [], array $separator = [])
{
if (empty($this->crumbs)) {
return null;
}
$crumbs = $this->crumbs;
$crumbsCount = count($crumbs);
$templater = $this->templater();
@@ -357,6 +357,8 @@ public function testInsertAfter()
*/
public function testRender()
{
$this->assertEmpty($this->breadcrumbs->render());
$this->breadcrumbs
->add('Home', '/', ['class' => 'first', 'innerAttrs' => ['data-foo' => 'bar']])
->add('Some text', ['controller' => 'tests_apps', 'action' => 'some_method'])

0 comments on commit dc14d47

Please sign in to comment.
You can’t perform that action at this time.