Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
homebox
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
homebox
Commits
6916d4e7
Commit
6916d4e7
authored
3 years ago
by
Joshua Sedler
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3265220
: Remove unnecessary blocks in the Homebox Dashboard Settings Page
parent
10bc2667
No related branches found
No related tags found
1 merge request
!5
Issue #3264557: Plan for 2.0.0-alpha1 bugfix release
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
homebox.routing.yml
+1
-1
1 addition, 1 deletion
homebox.routing.yml
src/Controller/HomeboxLayoutController.php
+17
-5
17 additions, 5 deletions
src/Controller/HomeboxLayoutController.php
src/Form/HomeboxSettingsForm.php
+1
-1
1 addition, 1 deletion
src/Form/HomeboxSettingsForm.php
with
19 additions
and
7 deletions
homebox.routing.yml
+
1
−
1
View file @
6916d4e7
...
...
@@ -44,7 +44,7 @@ homebox.settings_form:
_entity_access
:
'
homebox.settings'
homebox.block.admin_library
:
path
:
'
/admin/structure/homebox/block/library/{homebox}'
path
:
'
/admin/structure/homebox/block/library/{
theme}/{
homebox}'
defaults
:
_controller
:
'
\Drupal\homebox\Controller\HomeboxLayoutController::listBlocks'
_title
:
'
Place
block'
...
...
This diff is collapsed.
Click to expand it.
src/Controller/HomeboxLayoutController.php
+
17
−
5
View file @
6916d4e7
...
...
@@ -165,17 +165,15 @@ class HomeboxLayoutController extends ControllerBase implements ContainerInjecti
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The current request.
* @param string $theme
* Theme key of the block list.
* @param string $homebox
* Homebox id.
*
* @return array
* A render array as expected by the renderer.
*/
public
function
listBlocks
(
Request
$request
,
$homebox
)
{
// Only add blocks which work without any available context.
$definitions
=
$this
->
blockManager
->
getDefinitions
();
// Order by category, and then by admin label.
$definitions
=
$this
->
blockManager
->
getSortedDefinitions
(
$definitions
);
public
function
listBlocks
(
Request
$request
,
$theme
,
$homebox
)
{
// Since modals do not render any other part of the page, we need to render
// them manually as part of this listing.
...
...
@@ -191,6 +189,20 @@ class HomeboxLayoutController extends ControllerBase implements ContainerInjecti
$region
=
$request
->
query
->
get
(
'region'
);
$weight
=
$request
->
query
->
get
(
'weight'
);
// Only add blocks which work without any available context.
$definitions
=
$this
->
blockManager
->
getFilteredDefinitions
(
'block_ui'
,
$this
->
contextRepository
->
getAvailableContexts
(),
[
'theme'
=>
$theme
,
'region'
=>
$region
,
]);
// Order by category, and then by admin label.
$definitions
=
$this
->
blockManager
->
getSortedDefinitions
(
$definitions
);
// Filter out definitions that are not intended to be placed by the UI.
$definitions
=
array_filter
(
$definitions
,
function
(
array
$definition
)
{
return
empty
(
$definition
[
'_block_ui_hidden'
]);
});
$rows
=
[];
foreach
(
$definitions
as
$plugin_id
=>
$plugin_definition
)
{
$row
=
[];
...
...
This diff is collapsed.
Click to expand it.
src/Form/HomeboxSettingsForm.php
+
1
−
1
View file @
6916d4e7
...
...
@@ -320,7 +320,7 @@ class HomeboxSettingsForm extends EntityForm {
'#prefix'
=>
$region
,
'#type'
=>
'link'
,
'#title'
=>
$this
->
t
(
'Place block <span class="visually-hidden">in the @region region</span>'
,
[
'@region'
=>
$title
[
'label'
]]),
'#url'
=>
Url
::
fromRoute
(
'homebox.block.admin_library'
,
[
'homebox'
=>
$homebox
->
id
()],
[
'query'
=>
[
'region'
=>
$region
]]),
'#url'
=>
Url
::
fromRoute
(
'homebox.block.admin_library'
,
[
'theme'
=>
$this
->
themeManager
->
getActiveTheme
()
->
getName
(),
'homebox'
=>
$homebox
->
id
()],
[
'query'
=>
[
'region'
=>
$region
]]),
'#wrapper_attributes'
=>
[
'colspan'
=>
5
,
],
...
...
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