You are here

function vkxp_form_node_form_alter in VK CrossPoster 7.2

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

File

./vkxp.module, line 122

Code

function vkxp_form_node_form_alter(&$form, &$form_state) {

  // Do not process node form if it is not contains node type.
  if (empty($form['#node']->type)) {
    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);
  $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) {
    form_load_include($form_state, 'forms.inc', 'vkxp');
    _vkxp_process_node_form($form);
  }
}