You are here

function admin_settings_easy_social in Easy Social 6

Generate the administer settings form

1 string reference to 'admin_settings_easy_social'
easy_social_menu in ./easy_social.module
Implements hook_menu().

File

./easy_social.module, line 53
This is the file description for Easy Social module.

Code

function admin_settings_easy_social() {
  $form = array();
  $node_types = node_get_types();
  $options_types = array();
  foreach ($node_types as $type => $typeobj) {
    $options_types[$type] = $typeobj->name;
  }
  $form['easysocial_global_node_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Enable Easy Social for the Node Types'),
    '#options' => $options_types,
    '#default_value' => variable_get('easysocial_global_node_types', array()),
    '#description' => t('Select the content types which Easy Social will be available'),
  );
  $form['global_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Global Settings'),
    '#description' => t('Settings available for all content types'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['global_settings']['easysocial_global_typebtn'] = array(
    '#type' => 'radios',
    '#title' => t('Type of buttons'),
    '#options' => array(
      t('Horizontal'),
      t('Vertical'),
    ),
    '#default_value' => variable_get('easysocial_global_typebtn', 0),
  );
  $form['global_settings']['easysocial_global_btn_positioning'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Positioning of the buttons in node view'),
    '#description' => t('Available only for full node view'),
    '#options' => array(
      'top' => t('Top'),
      'bottom' => t('Bottom'),
    ),
    '#default_value' => variable_get('easysocial_global_btn_positioning', array(
      'bottom',
    )),
  );
  $form['global_settings']['easysocial_global_node_view'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Manage display in node view'),
    '#options' => array(
      'teaser' => t('Teaser'),
      'fullnode' => t('Full Node'),
    ),
    '#default_value' => variable_get('easysocial_global_node_view', array(
      'teaser',
      'fullnode',
    )),
  );
  $form['global_settings']['easysocial_global_social_buttons'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Social Buttons'),
    '#options' => array(
      'twitter' => 'Twitter',
      'facebook' => 'Facebook',
      'googleplus' => 'Google Plus',
      'linkedin' => 'Linked In',
    ),
    '#default_value' => variable_get('easysocial_global_social_buttons', array(
      'twitter',
      'facebook',
      'googleplus',
      'linkedin',
    )),
  );
  $form['global_settings']['twitter_global_data'] = array(
    '#type' => 'fieldset',
    '#title' => t('Twitter Info'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['global_settings']['twitter_global_data']['easysocial_tt_global_account_via'] = array(
    '#type' => 'textfield',
    '#title' => t('Mention account'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => variable_get('easysocial_tt_global_account_via', ''),
  );
  $form['global_settings']['twitter_global_data']['easysocial_tt_global_account_related'] = array(
    '#type' => 'textfield',
    '#title' => t('Related account'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => variable_get('easysocial_tt_global_account_related', ''),
  );
  $form['global_settings']['twitter_global_data']['easysocial_tt_global_account_description'] = array(
    '#type' => 'textfield',
    '#title' => t('Related account description'),
    '#size' => 120,
    '#maxlength' => 120,
    '#default_value' => variable_get('easysocial_tt_global_account_description', 'Check it out!'),
  );

  //Get Types where it is available
  $node_types_variable = variable_get('easysocial_global_node_types', array());

  //Cleanup array
  $node_types_variable = array_filter($node_types_variable);
  if (count($node_types_variable) > 0) {
    $form['override_settings'] = array(
      '#type' => 'fieldset',
      '#title' => t('Override Settings by Type'),
      '#description' => t('Settings by content type'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    foreach ($node_types_variable as $type => $typev) {
      $form['override_settings']['easysocial_settings_type_' . $type] = array(
        '#type' => 'fieldset',
        '#title' => t('Custom Settings for %type', array(
          '%type' => $options_types[$type],
        )),
        '#collapsible' => FALSE,
        '#collapsed' => TRUE,
      );
      $form['override_settings']['easysocial_settings_type_' . $type]['easysocial_' . $type . '_override'] = array(
        '#type' => 'checkbox',
        '#title' => t('Override'),
        '#description' => t('Check this option to override the global settings for this type'),
        '#default_value' => variable_get('easysocial_' . $type . '_override', ''),
      );
      $form['override_settings']['easysocial_settings_type_' . $type]['easysocial_' . $type . '_typebtn'] = array(
        '#type' => 'radios',
        '#title' => t('Type of buttons'),
        '#options' => array(
          t('Horizontal'),
          t('Vertical'),
        ),
        '#default_value' => variable_get('easysocial_' . $type . '_typebtn', ''),
      );
      $form['override_settings']['easysocial_settings_type_' . $type]['easysocial_' . $type . '_btn_positioning'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Positioning of the buttons in node view'),
        '#description' => t('Available only for full node view'),
        '#options' => array(
          'top' => t('Top'),
          'bottom' => t('Bottom'),
        ),
        '#default_value' => variable_get('easysocial_' . $type . '_btn_positioning', array(
          'bottom',
        )),
      );
      $form['override_settings']['easysocial_settings_type_' . $type]['easysocial_' . $type . '_node_view'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Manage display in node view'),
        '#options' => array(
          'teaser' => t('Teaser'),
          'fullnode' => t('Full Node'),
        ),
        '#default_value' => variable_get('easysocial_' . $type . '_node_view', array(
          'teaser',
          'fullnode',
        )),
      );
      $form['override_settings']['easysocial_settings_type_' . $type]['easysocial_' . $type . '_social_buttons'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Social Buttons'),
        '#options' => array(
          'twitter' => 'Twitter',
          'facebook' => 'Facebook',
          'googleplus' => 'Google Plus',
          'linkedin' => 'Linked In',
        ),
        '#default_value' => variable_get('easysocial_' . $type . '_social_buttons', array()),
      );
    }
  }
  $form = system_settings_form($form);
  return $form;
}