Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
8ca38526
Commit
8ca38526
authored
1 year ago
by
Jan-Hendrik Willms
Browse files
Options
Downloads
Patches
Plain Diff
fixes #3578
Closes #3578 Merge request
studip/studip!2474
parent
4325b052
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/navigation/Navigation.php
+8
-19
8 additions, 19 deletions
lib/navigation/Navigation.php
tests/unit/lib/classes/NavigationTest.php
+2
-4
2 additions, 4 deletions
tests/unit/lib/classes/NavigationTest.php
with
10 additions
and
23 deletions
lib/navigation/Navigation.php
+
8
−
19
View file @
8ca38526
...
...
@@ -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
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
tests/unit/lib/classes/NavigationTest.php
+
2
−
4
View file @
8ca38526
...
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment