You are here

function vkxp_form_alter in VK CrossPoster 6.3

Same name and namespace in other branches
  1. 6 vkxp.module \vkxp_form_alter()
  2. 6.2 vkxp.module \vkxp_form_alter()
  3. 7 vkxp.module \vkxp_form_alter()

Implements hook_form_FORM_ID_alter(). Alters node add/edit form.

File

./vkxp.module, line 105

Code

function vkxp_form_alter(&$form, &$form_state, $form_id) {

  // Do not process node form if it is not contains node type.
  if (empty($form['#node']->type) || $form_id != $form['#node']->type . '_node_form') {
    return;
  }

  // Check node type and user access to see whether we should process a node form.
  $type_enabled = variable_get('vkxp_node_enabled_' . $form['#node']->type, NULL);
  $user_access = user_access('post to vkontakte');

  // If node type matches all requirements we have to add new fields to form.
  if ($type_enabled && $user_access) {
    module_load_include('forms.inc', 'vkxp');
    _vkxp_process_node_form($form);
  }
}