Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nl_menubuilder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Maksym Chubin
nl_menubuilder
Commits
75b339c7
Commit
75b339c7
authored
3 years ago
by
Maksym Chubin
Browse files
Options
Downloads
Patches
Plain Diff
[FEATURE] Change relation to content elements
parent
ceed6947
Branches
master
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Classes/Domain/Model/MenuItem.php
+67
-10
67 additions, 10 deletions
Classes/Domain/Model/MenuItem.php
with
67 additions
and
10 deletions
Classes/Domain/Model/MenuItem.php
+
67
−
10
View file @
75b339c7
...
...
@@ -239,27 +239,84 @@ class MenuItem extends AbstractEntity
}
/**
* Returns the content
*
* @return string $content
* @return string
*/
public
function
getContent
():
string
{
$uids
=
array_map
(
function
(
TtContent
$ce
)
{
return
$ce
->
getUid
();
},
$this
->
getContentRecords
()
->
toArray
());
return
implode
(
','
,
$uids
);
return
$this
->
getContentElementIdList
();
}
/**
* @return ObjectStorage
* Get content elements
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public
function
getContent
Record
s
():
ObjectStorage
public
function
getContent
Element
s
():
ObjectStorage
{
return
$this
->
content
;
}
/**
* Set content element list
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $contentElements content elements
*/
public
function
setContentElements
(
ObjectStorage
$contentElements
):
void
{
$this
->
content
=
$contentElements
;
}
/**
* Adds a content element to the record
*
* @param TtContent $contentElement
*/
public
function
addContentElement
(
TtContent
$contentElement
):
void
{
if
(
$this
->
getContentElements
()
===
null
)
{
$this
->
content
=
new
\TYPO3\CMS\Extbase\Persistence\ObjectStorage
();
}
$this
->
content
->
attach
(
$contentElement
);
}
/**
* Get id list of content elements
*
* @return string
*/
public
function
getContentElementIdList
():
string
{
return
$this
->
getIdOfContentElements
();
}
/**
* Get translated id list of content elements
*
* @return string
*/
public
function
getTranslatedContentElementIdList
():
string
{
return
$this
->
getIdOfContentElements
(
false
);
}
/**
* Collect id list
*
* @param bool $original
* @return string
*/
protected
function
getIdOfContentElements
(
bool
$original
=
true
):
string
{
$idList
=
[];
$contentElements
=
$this
->
getContentElements
();
if
(
$contentElements
)
{
foreach
(
$this
->
getContentElements
()
as
$contentElement
)
{
$idList
[]
=
$original
?
$contentElement
->
getUid
()
:
$contentElement
->
_getProperty
(
'_localizedUid'
);
}
}
return
implode
(
','
,
$idList
);
}
/**
* Adds a MenuItem
*
...
...
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