You are here

function responsive_share_buttons_settings in Responsive Share Buttons 7

Settings form as implemented by hook_menu.

1 string reference to 'responsive_share_buttons_settings'
responsive_share_buttons_menu in ./responsive_share_buttons.module
Implements hook_menu().

File

./responsive_share_buttons.admin.inc, line 11
Functionality for Responsive share buttons administration.

Code

function responsive_share_buttons_settings($form, &$form_state) {
  $form['responsive_share_buttons'] = array(
    '#type' => 'fieldset',
    '#title' => t('Responsive Buttons'),
    '#tree' => TRUE,
    '#theme' => 'responsive_share_buttons_settings',
  );

  // Get the current networks, sorted by weight.
  $networks = variable_get('responsive_share_buttons', array());
  uasort($networks, 'drupal_sort_weight');
  foreach ($networks as $name => $network) {
    $form['responsive_share_buttons']['networks'][$name]['active'] = array(
      '#type' => 'checkbox',
      '#title' => $name,
      '#default_value' => isset($network['active']) ? $network['active'] : FALSE,
    );
    $form['responsive_share_buttons']['networks'][$name]['weight'] = array(
      '#type' => 'weight',
      '#default_value' => isset($network['weight']) ? $network['weight'] : 0,
      '#attributes' => array(
        'class' => array(
          'item-row-weight',
        ),
      ),
    );
  }
  $form['responsive_share_buttons_twitter_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Twitter username'),
    '#default_value' => variable_get('responsive_share_buttons_twitter_name', ''),
    '#description' => t('Add a twitter name for tweets to include a via mention'),
  );
  $form['#validate'][] = 'responsive_share_buttons_settings_validate';
  return system_settings_form($form);
}