Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Drupal
Sharer toolbar module
Commits
b09f0c05
Commit
b09f0c05
authored
Apr 17, 2015
by
Philippe Mouchel
Browse files
Define permission to access sharer toolbar
[refs #71131]
parent
95a79c81
Changes
1
Show whitespace changes
Inline
Side-by-side
sharer_toolbar.module
View file @
b09f0c05
...
...
@@ -11,6 +11,10 @@
*/
function
sharer_toolbar_permission
()
{
return
array
(
'access sharer toolbar'
=>
array
(
'title'
=>
t
(
'Access sharer toolbar'
),
'description'
=>
t
(
'Choose who can acces sharers on front.'
),
),
'admin sharer toolbar'
=>
array
(
'title'
=>
t
(
'Administer sharer toolbar'
),
'description'
=>
t
(
'Choose which social sharer to be displayed and other stuffs.'
),
...
...
@@ -120,6 +124,12 @@ function sharer_toolbar_sharer_toolbar_available_sharer() {
* Implements hook_process_node().
*/
function
sharer_toolbar_process_node
(
&
$variables
)
{
// Default value for sharer toolbar
$variables
[
'sharer_toolbar'
]
=
NULL
;
// Generate only if user can access it
if
(
user_access
(
'access sharer toolbar'
))
{
module_load_include
(
'inc'
,
'sharer_toolbar'
);
$sharing_buttons
=
array
();
...
...
@@ -136,7 +146,6 @@ function sharer_toolbar_process_node(&$variables) {
// Transform URL
_sharer_toolbar_generate_sharer_url
(
$sharer
[
'url'
],
$variables
);
}
// or unset before sending array to template
...
...
@@ -155,7 +164,5 @@ function sharer_toolbar_process_node(&$variables) {
'sharers'
=>
$active_sharers
,
));
}
else
{
$variables
[
'sharer_toolbar'
]
=
NULL
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment