Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
block_region_permissions-3429015
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
block_region_permissions-3429015
Commits
25e70712
Commit
25e70712
authored
7 years ago
by
Joshua Roberson
Browse files
Options
Downloads
Patches
Plain Diff
Remove extra condition and adjust comments
parent
30b33ddd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
block_region_permissions.module
+3
-5
3 additions, 5 deletions
block_region_permissions.module
with
3 additions
and
5 deletions
block_region_permissions.module
+
3
−
5
View file @
25e70712
...
@@ -38,7 +38,7 @@ function block_region_permissions_form_block_admin_display_form_alter(&$form, Fo
...
@@ -38,7 +38,7 @@ function block_region_permissions_form_block_admin_display_form_alter(&$form, Fo
// Region label or message.
// Region label or message.
list
(,
$region_key
,)
=
explode
(
'-'
,
$block_key
);
list
(,
$region_key
,)
=
explode
(
'-'
,
$block_key
);
}
}
elseif
(
substr
(
$block_key
,
0
,
7
)
!=
'region-'
&&
$block
=
Block
::
load
(
$block_key
))
{
elseif
(
$block
=
Block
::
load
(
$block_key
))
{
// Region block.
// Region block.
$region_key
=
$block
->
getRegion
();
$region_key
=
$block
->
getRegion
();
// Save master list of options one time.
// Save master list of options one time.
...
@@ -69,8 +69,7 @@ function block_region_permissions_form_block_admin_display_form_alter(&$form, Fo
...
@@ -69,8 +69,7 @@ function block_region_permissions_form_block_admin_display_form_alter(&$form, Fo
}
}
}
}
// Remove region select field options for regions the user cannot
// Remove region select field options for regions the user cannot administer.
// administer.
if
(
!
empty
(
$region_block_keys
))
{
if
(
!
empty
(
$region_block_keys
))
{
// Remove options from master list.
// Remove options from master list.
foreach
(
$region_options
as
$region_key
=>
$options
)
{
foreach
(
$region_options
as
$region_key
=>
$options
)
{
...
@@ -96,8 +95,7 @@ function block_region_permissions_form_block_form_alter(&$form, FormStateInterfa
...
@@ -96,8 +95,7 @@ function block_region_permissions_form_block_form_alter(&$form, FormStateInterfa
// Get theme name.
// Get theme name.
$theme_key
=
$form
[
'theme'
][
'#value'
];
$theme_key
=
$form
[
'theme'
][
'#value'
];
// Remove region select field options for regions the user cannot
// Remove region select field options for regions the user cannot administer.
// administer.
$region_options
=
$form
[
'region'
][
'#options'
];
$region_options
=
$form
[
'region'
][
'#options'
];
foreach
(
$region_options
as
$region_key
=>
$options
)
{
foreach
(
$region_options
as
$region_key
=>
$options
)
{
if
(
!
\Drupal
::
currentUser
()
->
hasPermission
(
"administer
$theme_key
$region_key
"
))
{
if
(
!
\Drupal
::
currentUser
()
->
hasPermission
(
"administer
$theme_key
$region_key
"
))
{
...
...
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