You are here

function rrssb_get_chosen in Ridiculously Responsive Social Sharing Buttons 7.2

Same name and namespace in other branches
  1. 7 rrssb.module \rrssb_get_chosen()

Return the chosen buttons, or the default values if not yet set.

2 calls to rrssb_get_chosen()
rrssb_form in ./rrssb.module
Implements hook_form().
rrssb_settings in ./rrssb.module
Fetch buttons settings.

File

./rrssb.module, line 471

Code

function rrssb_get_chosen() {
  $defaults = array(
    'email' => array(
      'enabled' => TRUE,
      'weight' => -20,
    ),
    'facebook' => array(
      'enabled' => TRUE,
      'weight' => -19,
    ),
    'linkedin' => array(
      'enabled' => TRUE,
      'weight' => -18,
    ),
    'twitter' => array(
      'enabled' => TRUE,
      'weight' => -17,
    ),
    'googleplus' => array(
      'enabled' => TRUE,
      'weight' => -16,
    ),
    'pinterest' => array(
      'enabled' => TRUE,
      'weight' => -15,
    ),
  );
  $chosen = variable_get('rrssb_chosen', $defaults);
  if (!is_array(current($chosen))) {

    // Migrate from old format of variable.
    $weight = -20;
    foreach ($chosen as $name => &$enabled) {
      $enabled = array(
        'enabled' => $enabled ? TRUE : FALSE,
        'weight' => $weight++,
      );
    }
  }
  return $chosen;
}