Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_cfg_common
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor 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
WCMS
uw_cfg_common
Commits
e198c336
Commit
e198c336
authored
3 years ago
by
Kevin Paxman
Committed by
Kevin Paxman
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-4939: change update to only update default settings to old number
parent
33db82d6
No related branches found
No related tags found
1 merge request
!129
Feature/istwcms 4939 ebremner listing blocks num items
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
uw_cfg_common.install
+14
-15
14 additions, 15 deletions
uw_cfg_common.install
with
14 additions
and
15 deletions
uw_cfg_common.install
+
14
−
15
View file @
e198c336
...
@@ -242,22 +242,24 @@ function _uw_cfg_common_create_term($taxonomy_name, $vocab_machine_name, $weight
...
@@ -242,22 +242,24 @@ function _uw_cfg_common_create_term($taxonomy_name, $vocab_machine_name, $weight
}
}
/**
/**
* Set default settings for listing page blocks.
* For listing page blocks items per page, when default settings were used,
* change to the original default number of items.
*/
*/
function
uw_cfg_common_update_8101
()
{
function
uw_cfg_common_update_8101
()
{
// Block ids that need to be changed.
// Block ids that need to be changed, and what the original default was.
// For some reason, we didn't originally use the same number for everything.
$block_ids
=
[
$block_ids
=
[
'views_block:uw_view_blogs-blogs_listing_block'
,
'views_block:uw_view_blogs-blogs_listing_block'
=>
5
,
'views_block:uw_view_events-events_listing_block'
,
'views_block:uw_view_events-events_listing_block'
=>
10
,
'views_block:uw_view_news_items-news_items_listing_block'
,
'views_block:uw_view_news_items-news_items_listing_block'
=>
10
,
];
];
// Load all the nodes.
// Load all the nodes.
$nodes
=
Node
::
loadMultiple
();
$nodes
=
Node
::
loadMultiple
();
// Step through each node and set the default setting
// Step through each node and set
any that were using
the default setting
// to
3 on listing blocks
.
// to
the number that was the default before this change
.
foreach
(
$nodes
as
$node
)
{
foreach
(
$nodes
as
$node
)
{
// Flag to save the node, have this to save processing
// Flag to save the node, have this to save processing
...
@@ -279,19 +281,16 @@ function uw_cfg_common_update_8101() {
...
@@ -279,19 +281,16 @@ function uw_cfg_common_update_8101() {
// If this component is one that needs to be changed,
// If this component is one that needs to be changed,
// then check for setting and change if required.
// then check for setting and change if required.
if
(
in_array
(
$component
->
getPluginId
(),
$block_ids
))
{
if
(
in_array
(
$component
->
getPluginId
(),
array_keys
(
$block_ids
))
)
{
// Load the config for the block.
// Load the config for the block.
$configurations
=
$component
->
get
(
'configuration'
);
$configurations
=
$component
->
get
(
'configuration'
);
// If the config is none of 5, it needs to be changed to 3.
// If the config is set to "none", it needs to be changed to
if
(
// be set to the number that was the old default value.
$configurations
[
'items_per_page'
]
==
'none'
||
if
(
$configurations
[
'items_per_page'
]
==
'none'
)
{
$configurations
[
'items_per_page'
]
==
'5'
)
{
// Change the config and save the component.
// Change the config and save the component.
$configurations
[
'items_per_page'
]
=
'3'
;
$configurations
[
'items_per_page'
]
=
$block_ids
[
$component
->
getPluginId
()]
;
$component
->
setConfiguration
(
$configurations
);
$component
->
setConfiguration
(
$configurations
);
// Set the save node flag so that we know to
// Set the save node flag so that we know to
...
...
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