You are here

function vkxp_admin_main_settings in VK CrossPoster 7.2

Same name and namespace in other branches
  1. 6.3 vkxp.admin.inc \vkxp_admin_main_settings()
  2. 6 vkxp.admin.inc \vkxp_admin_main_settings()
  3. 6.2 vkxp.admin.inc \vkxp_admin_main_settings()
  4. 7 vkxp.admin.inc \vkxp_admin_main_settings()

Page callback. Return form with VKXP main settings.

1 string reference to 'vkxp_admin_main_settings'
vkxp_menu in ./vkxp.module
Implements hook_menu().

File

./vkxp.admin.inc, line 12
vkxp.admin.inc Contains VKXP settings form.

Code

function vkxp_admin_main_settings($form, &$form_state) {
  $form['vkxp_access_token'] = array(
    '#type' => 'fieldset',
    '#title' => t('Access token'),
    '#collapsible' => TRUE,
  );
  $form['vkxp_access_token']['status'] = array(
    '#type' => 'markup',
    '#markup' => variable_get('vkxp_access_token') ? '<span style="color:green;">' . t('Recieved') . '</span>' : '<span style="color:red;">' . t('Not recieved') . '</span>',
  );

  // Application settings.
  $form['vkxp_application'] = array(
    '#type' => 'fieldset',
    '#title' => t('Application settings'),
    '#collapsible' => TRUE,
    '#description' => t('Note: You have to <a href="@url" target="_blank">create</a> a <strong>standalone</strong> application to make this module work.', array(
      '@url' => 'http://vk.com/editapp?act=create',
    )),
  );
  $form['vkxp_application']['vkxp_app_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Application ID'),
    '#description' => t('ID of vk application.'),
    '#default_value' => variable_get('vkxp_app_id'),
    '#required' => TRUE,
    '#element_validate' => array(
      'element_validate_integer_positive',
    ),
  );
  $form['vkxp_application']['vkxp_app_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('Application secret code'),
    '#description' => t('Secret code of vk application.'),
    '#default_value' => variable_get('vkxp_app_secret'),
    '#required' => TRUE,
  );

  // Owner settings.
  $form['vkxp_owner'] = array(
    '#type' => 'fieldset',
    '#title' => t('Owner settings'),
    '#description' => t('Set user or group to which data will be transferred.'),
    '#collapsible' => TRUE,
  );
  $form['vkxp_owner']['vkxp_owner_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Owner ID'),
    '#description' => t('User ID or Group ID.'),
    '#default_value' => variable_get('vkxp_owner_id', ''),
    '#required' => TRUE,
    '#element_validate' => array(
      'element_validate_integer_positive',
    ),
  );
  $form['vkxp_owner']['vkxp_wall_owner'] = array(
    '#type' => 'select',
    '#title' => t('Select owner type'),
    '#description' => t('Who owns the ID above.'),
    '#options' => array(
      'group' => t('Group'),
      'user' => t('User'),
    ),
    '#default_value' => variable_get('vkxp_wall_owner', 'group'),
  );

  // Additional settings.
  $form['vkxp_additional'] = array(
    '#type' => 'fieldset',
    '#title' => t('Additional settings'),
    '#collapsible' => TRUE,
  );
  $form['vkxp_additional']['vkxp_official'] = array(
    '#type' => 'checkbox',
    '#title' => t('Write from group name'),
    '#description' => t('Check this if you want to post messages from group name.'),
    '#default_value' => variable_get('vkxp_official', TRUE),
  );
  $form['vkxp_additional']['vkxp_add_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add link on wall to posted page'),
    '#default_value' => variable_get('vkxp_add_link', FALSE),
    '#description' => t('Check this if you want to post node url on vk wall.'),
  );

  // Additional settings.
  $form['vkxp_additional_features'] = array(
    '#type' => 'fieldset',
    '#title' => t('Additional features'),
    '#collapsible' => TRUE,
  );
  $form['vkxp_additional_features']['vkxp_add_post_tab'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add node tab with a post to VK button'),
    '#default_value' => variable_get('vkxp_add_post_tab', FALSE),
    '#description' => t('Check this if you want to enable new tab with a post button.'),
  );
  return system_settings_form($form);
}