You are here

function _vkxp_process_node_form in VK CrossPoster 6.3

Same name and namespace in other branches
  1. 6 vkxp.module \_vkxp_process_node_form()
  2. 6.2 vkxp.module \_vkxp_process_node_form()
  3. 7.2 vkxp.forms.inc \_vkxp_process_node_form()
  4. 7 vkxp.module \_vkxp_process_node_form()

Add vkxp fieldset to node add/edit form.

Parameters

$form: Node add/edit form.

1 call to _vkxp_process_node_form()
vkxp_form_alter in ./vkxp.module
Implements hook_form_FORM_ID_alter(). Alters node add/edit form.

File

./vkxp.forms.inc, line 117
vkxp.forms.inc Contains node form alters.

Code

function _vkxp_process_node_form(&$form) {
  $form['vkxp'] = array(
    '#type' => 'fieldset',
    '#title' => t('VKontakte CrossPoster'),
    '#group' => 'additional_settings',
    '#weight' => -10,
  );
  $form['vkxp']['vkxp_post_this_node'] = array(
    '#type' => 'checkbox',
    '#title' => t('Post this node to VK'),
    '#default_value' => variable_get('vkxp_node_enabled_default_' . $form['#node']->type, ''),
    '#description' => t('After you submit this node it will be posted to VK.'),
  );

  // Disable crosspost if cURL library is not installed on a server.
  if (!function_exists('curl_init')) {
    $form['vkxp']['vkxp_post_this_node']['#disabled'] = TRUE;
    $form['vkxp']['vkxp_post_this_node']['#value'] = 0;
    $form['vkxp']['vkxp_post_this_node']['#description'] = t("You can't crosspost nodes until cURL library is not installed on your server.");
  }

  // Disable crosspost if no access token recieved.
  if (!variable_get('vkxp_access_token', '')) {
    $form['vkxp']['vkxp_post_this_node']['#disabled'] = TRUE;
    $form['vkxp']['vkxp_post_this_node']['#value'] = 0;
    $form['vkxp']['vkxp_post_this_node']['#description'] = t("You can't crosspost nodes until access token not recieved from VK.");
  }
}