Skip to content
Snippets Groups Projects
Commit 8ca38526 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fixes #3578

Closes #3578

Merge request studip/studip!2474
parent 4325b052
No related branches found
No related tags found
No related merge requests found
......@@ -352,38 +352,27 @@ class Navigation implements IteratorAggregate
}
/**
* Set the image of this navigation item. Additional HTML
* attributes can be passed using the $options parameter
* (like 'style' or 'onclick').
* Set the image of this navigation item.
*
* @param Icon $image an instance of class Icon depicting this item
* @param array $link_attributes additional link attributes
* @param \Icon|null $image an instance of class Icon depicting this item
* or null to remove the image
*/
public function setImage(\Icon $image = null, $linkAttributes = [])
public function setImage(?\Icon $image)
{
$this->image = $image;
$this->link_attributes = array_merge(
$this->link_attributes,
$linkAttributes
);
}
/**
* Set the image for the active state of this navigation item.
* If no active image is set, the normal image is used for the
* active state. Additional HTML attributes can be passed using
* the $options parameter (like 'style' or 'onclick').
* active state.
*
* @param Icon $image an instance of class Icon depicting this item
* @param array $link_attributes additional link attributes
* @param \Icon|null $image an instance of class Icon depicting this item
* or null to remove the image
*/
public function setActiveImage(\Icon $image = null, $linkAttributes = [])
public function setActiveImage(?\Icon $image)
{
$this->active_image = $image;
$this->link_attributes = array_merge(
$this->link_attributes,
$linkAttributes
);
}
/**
......
......@@ -44,14 +44,12 @@ class NavigationTest extends \Codeception\Test\Unit
$navigation = new Navigation('test', 'foo.php');
$this->assertNull($navigation->getImage());
$icon = Icon::create('foo', 'clickable');
$link_attrs = ['alt' => 'foo'];
$icon = Icon::create('foo', Icon::ROLE_CLICKABLE);
$navigation->setImage($icon, $link_attrs);
$navigation->setImage($icon);
$this->assertTrue($navigation->isVisible(true));
$this->assertEquals($icon, $navigation->getImage());
$this->assertEquals($link_attrs, $navigation->getLinkAttributes());
}
public function testActiveImage ()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment