Commit 95a79c81 authored by Philippe Mouchel's avatar Philippe Mouchel
Browse files

New field to define front sharer toolbar title

[refs #71123]
parent 5b2f81bc
......@@ -7,7 +7,7 @@
?>
<div id="sharer-toolbar-container">
<div id="sharer-toolbar"><?php print $title; ?></div>
<div id="sharer-toolbar"><?php print t($title); ?></div>
<ul id="sharer-toolbar">
<?php foreach ($sharers as $sid => $sharer) : ?>
<li class="shareLink__<?php print $sid; ?>">
......
......@@ -11,8 +11,16 @@
function sharer_toolbar_config_form($form, &$form_state) {
module_load_include('inc', 'sharer_toolbar');
// To make checkboxes sortable
$form['#tree'] = TRUE;
// Sharer toolbar title
$form['sharer_toolbar_title'] = array(
'#type' => 'textfield',
'#title' => t('Sharer toolbar title'),
'#description' => t('Set this value in english, and translate it using !link.', array('!link' => l(t('translatable strings'), 'admin/config/regional/translate/translate'))),
'#default_value' => variable_get('sharer_toolbar_title', 'Share'),
);
// Make sharers sortable
$form['sharers']['#tree'] = TRUE;
// List all available sharers
$sharers = _sharer_toolbar_get_ordered_available_sharers();
......@@ -73,6 +81,9 @@ function sharer_toolbar_config_form_submit($form, &$form_state) {
$sharers_order = array();
$sharers_configuration = array();
// Save sharer toolbar title
variable_set('sharer_toolbar_title', $form_state['values']['sharer_toolbar_title']);
// Get available sharers and submitted values to compare them
$available_sharers = _sharer_toolbar_get_available_sharers();
$submitted_sharers = $form_state['values']['sharers'];
......
......@@ -151,7 +151,7 @@ function sharer_toolbar_process_node(&$variables) {
// Render HTML for sharer toolbar
if (!empty($active_sharers)) {
$variables['sharer_toolbar'] = theme('sharer_toolbar', array(
'title' => variable_get('sharer_toolbar_title', t('Share')),
'title' => variable_get('sharer_toolbar_title', 'Share'),
'sharers' => $active_sharers,
));
}
......
......@@ -40,7 +40,13 @@ function theme_sharer_toolbar_config_form($variables) {
// Render draggable table
$output = drupal_render($form['note']);
$output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'sharers-order')));
$output .= drupal_render($form['sharer_toolbar_title']);
$output .= drupal_render($form['sharers_order_title']);
$output .= theme('table', array(
'attributes' => array('id' => 'sharers-order'),
'header' => $header,
'rows' => $rows,
));
$output .= drupal_render_children($form);
// Add draggable feature to table#sharers-order
......
Markdown is supported
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