Commit b09f0c05 authored by Philippe Mouchel's avatar Philippe Mouchel
Browse files

Define permission to access sharer toolbar

[refs #71131]
parent 95a79c81
......@@ -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;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment