Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_dashboard
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
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_dashboard
Commits
b4d455da
Commit
b4d455da
authored
6 months ago
by
Chris Shantz
Browse files
Options
Downloads
Plain Diff
Merge branch '1.0.x' into prod/1.0.x
parents
392c2f41
7fe67cb7
No related branches found
No related tags found
1 merge request
!44
Feature/istwcms 7264 kpaxman remove dashboard blocks
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Plugin/Block/FormsListBlock.php
+29
-0
29 additions, 0 deletions
src/Plugin/Block/FormsListBlock.php
uw_dashboard.module
+32
-0
32 additions, 0 deletions
uw_dashboard.module
with
61 additions
and
0 deletions
src/Plugin/Block/FormsListBlock.php
+
29
−
0
View file @
b4d455da
...
...
@@ -111,6 +111,35 @@ class FormsListBlock extends BlockBase implements ContainerFactoryPluginInterfac
// Render the entity list.
$build
[
'entity_list'
]
=
$render
;
// Get the total number of results. There was no easy way
// to get this value from the render array, either using the
// translatable markup, of the entity list builder. The only
// way was the get the actual string and pick off up to the
// first space.
if
(
count
(
$build
[
'entity_list'
][
'info'
])
>
0
&&
isset
(
$build
[
'entity_list'
][
'info'
][
'#markup'
])
)
{
$total_num_of_results
=
strtok
(
$build
[
'entity_list'
][
'info'
][
'#markup'
]
->
__toString
(),
' '
);
}
else
{
$total_num_of_results
=
0
;
}
// If the total number of results is greater than 50, then add
// a link to view all the webforms to the info part of the
// render array.
if
(
$total_num_of_results
>
50
)
{
$build
[
'entity_list'
][
'info'
][
'#markup'
]
.
=
$this
->
t
(
'<br><a href="../admin/structure/webform">View all webforms</a>'
);
$build
[
'entity_list'
][
'more_info'
][
'#markup'
]
=
$this
->
t
(
'<p class="pager__items"><a href="../admin/structure/webform?page=1">Next ›</a></p>'
);
}
// Remove the pager from the webform list.
unset
(
$build
[
'entity_list'
][
'pager'
]);
return
$build
;
}
...
...
This diff is collapsed.
Click to expand it.
uw_dashboard.module
+
32
−
0
View file @
b4d455da
...
...
@@ -122,3 +122,35 @@ function uw_dashboard_entity_type_alter(array &$entity_types) {
// This should ensure all works as before, except is new function is called.
$entity_types
[
'webform'
]
->
setHandlerClass
(
'list_builder'
,
UWWebformEntityListBuilder
::
class
);
}
/**
* Implements hook_views_pre_execute().
*/
function
uw_dashboard_views_pre_execute
(
ViewExecutable
$view
)
{
// Have a variable that can be used "globally".
static
$view_instances_count
;
// If there is no count yet, set it to 0.
if
(
!
isset
(
$view_instances_count
))
{
$view_instances_count
=
0
;
}
// The views that need the pager id adjusted.
$view_ids
=
[
'uw_view_content_list'
,
'uw_view_pub_reference'
,
'uw_view_pub_keywords'
,
'uw_view_pub_authors'
,
];
// If a view needs its pager id adjusted, then do it.
if
(
in_array
(
$view
->
id
(),
$view_ids
))
{
// Increment the counter, so we get the correct pager id.
$view_instances_count
++
;
// Set the pager id in the view.
$view
->
pager
->
options
[
'id'
]
=
$view_instances_count
;
}
}
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