Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
208
Issues
208
List
Boards
Labels
Service Desk
Milestones
Merge Requests
29
Merge Requests
29
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
e45b6a7c
Commit
e45b6a7c
authored
47 minutes ago
by
Emiliano Balbuena
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): Featured content entities
parent
05d2acc9
epic/minds-pro
1 merge request
!292
WIP: (feat): Minds Pro (development branch) - Release 2
Pipeline
#75261511
failed with stages
in 4 minutes and 12 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
HydrateSettingsDelegate.php
Core/Pro/Delegates/HydrateSettingsDelegate.php
+23
-0
Settings.php
Core/Pro/Settings.php
+7
-1
No files found.
Core/Pro/Delegates/HydrateSettingsDelegate.php
View file @
e45b6a7c
...
...
@@ -12,6 +12,7 @@ use Minds\Core\EntitiesBuilder;
use
Minds\Core\Pro\Settings
;
use
Minds\Entities\Object\Carousel
;
use
Minds\Entities\User
;
use
Minds\Helpers\Text
;
class
HydrateSettingsDelegate
{
...
...
@@ -74,6 +75,28 @@ class HydrateSettingsDelegate
error_log
(
$e
);
}
try
{
if
(
$user
->
getPinnedPosts
())
{
$pinnedPosts
=
$this
->
entitiesBuilder
->
get
([
'guids'
=>
Text
::
buildArray
(
$user
->
getPinnedPosts
())]);
uasort
(
$pinnedPosts
,
function
(
$a
,
$b
)
{
if
(
!
$a
||
!
$b
)
{
return
0
;
}
return
(
$a
->
time_created
<
$b
->
time_created
)
?
1
:
-
1
;
});
$featuredContent
=
Text
::
buildArray
(
array_values
(
array_filter
(
array_map
(
function
(
$pinnedPost
)
{
return
$pinnedPost
->
entity_guid
?:
$pinnedPost
->
guid
?:
null
;
},
$pinnedPosts
))));
$settings
->
setFeaturedContent
(
$featuredContent
);
}
}
catch
(
\Exception
$e
)
{
error_log
(
$e
);
}
return
$settings
;
}
}
This diff is collapsed.
Click to expand it.
Core/Pro/Settings.php
View file @
e45b6a7c
...
...
@@ -33,13 +33,15 @@ use Minds\Traits\MagicAttributes;
* @method array getFooterLinks()
* @method Settings setFooterLinks(array $footerLinks)
* @method array getTagList()
* @method Settings setTagList(array $
footerLinks
)
* @method Settings setTagList(array $
tagList
)
* @method string getScheme()
* @method Settings setScheme(string $scheme)
* @method string getBackgroundImage()
* @method Settings setBackgroundImage(string $backgroundImage)
* @method string getLogoImage()
* @method Settings setLogoImage(string $logoImage)
* @method array getFeaturedContent()
* @method Settings setFeaturedContent(array $featuredContent)
*/
class
Settings
implements
JsonSerializable
{
...
...
@@ -93,6 +95,9 @@ class Settings implements JsonSerializable
/** @var string */
protected
$scheme
;
/** @var array */
protected
$featuredContent
=
[];
/**
* @return array
*/
...
...
@@ -116,6 +121,7 @@ class Settings implements JsonSerializable
'logo_guid'
=>
(
string
)
$this
->
logoGuid
,
'background_image'
=>
$this
->
backgroundImage
,
'logo_image'
=>
$this
->
logoImage
,
'featured_content'
=>
$this
->
featuredContent
,
'scheme'
=>
$this
->
scheme
,
'styles'
=>
$this
->
buildStyles
(),
];
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment