You are here

function _vkxp_process_node_form in VK CrossPoster 7

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

Add vkxp fieldset to node forms.

Parameters

$form: Node add/edit form.

1 call to _vkxp_process_node_form()
vkxp_form_alter in ./vkxp.module
Implements hook_form_alter().

File

./vkxp.module, line 133

Code

function _vkxp_process_node_form(&$form) {

  // Change node form only if user has access to crosspost nodes.
  if (user_access('post to vkontakte')) {
    $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.com'),
      '#default_value' => variable_get('vkxp_enabled_default', 0),
      '#description' => t('After you submit this node it will be posted to http://vk.com.'),
    );

    // 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.");
    }
  }
}