Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
simple_klaro
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
simple_klaro
Merge requests
!6
#3259797
Add blockAccess to control block visibility if Klaro not enabled
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
#3259797
Add blockAccess to control block visibility if Klaro not enabled
issue/simple_klaro-3259797:3259797-typeerror-argument-1
into
1.x
Overview
0
Commits
2
Pipelines
0
Changes
1
Merged
Norman Kämper-Leymann
requested to merge
issue/simple_klaro-3259797:3259797-typeerror-argument-1
into
1.x
3 years ago
Overview
0
Commits
2
Pipelines
0
Changes
1
Expand
Closes
#3259797
0
0
Merge request reports
Compare
1.x
version 2
628a67c7
3 years ago
version 1
db2561fd
3 years ago
1.x (base)
and
latest version
latest version
628a67c7
2 commits,
3 years ago
version 2
628a67c7
2 commits,
3 years ago
version 1
db2561fd
1 commit,
3 years ago
1 file
+
14
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/Plugin/Block/PreferencesDialog.php
+
14
−
5
Options
@@ -2,9 +2,11 @@
namespace
Drupal\simple_klaro\Plugin\Block
;
use
Drupal\Core\Access\AccessResult
;
use
Drupal\Core\Block\BlockBase
;
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Core\Plugin\ContainerFactoryPluginInterface
;
use
Drupal\Core\Session\AccountInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
@@ -58,14 +60,21 @@ class PreferencesDialog extends BlockBase implements ContainerFactoryPluginInter
*/
public
function
build
()
{
$config
=
$this
->
configFactory
->
get
(
'simple_klaro.settings'
);
$klaro_enabled
=
$config
->
get
(
'enabled'
);
if
(
!
$klaro_enabled
)
{
return
FALSE
;
}
return
[
'#markup'
=>
'<a href="#" id="klaro-preferences">'
.
$config
->
get
(
'preferences'
)
.
'</a>'
,
];
}
/**
* {@inheritdoc}
*/
protected
function
blockAccess
(
AccountInterface
$account
)
{
$config
=
$this
->
configFactory
->
get
(
'simple_klaro.settings'
);
$klaro_enabled
=
$config
->
get
(
'enabled'
);
if
(
!
$klaro_enabled
)
{
return
AccessResult
::
forbidden
();
}
return
parent
::
blockAccess
(
$account
);
}
}
Loading