You are here

function afb_after_build in Advanced Form Block 7

Implements hook_after_build().

1 string reference to 'afb_after_build'
afb_form_alter in ./afb.module
Implements hook_form_alter().

File

./afb.module, line 517
Allows administrators to create blockd of node add/edit forms.

Code

function afb_after_build($form, &$form_state) {
  $delta = $form['#node']->delta;
  $block_detail_array = afb_get_node_form_block_data($delta);
  $block_detail_data = unserialize($block_detail_array->data);
  $tabs = empty($block_detail_data['vertical_tabs']) ? array() : $block_detail_data['vertical_tabs'];
  foreach ($tabs as $key => $value) {
    if ($value === 0) {
      switch ($key) {
        case 'Revision information':
          $form['revision_information']['#access'] = FALSE;
          break;
        case 'Authoring information':
          $form['author']['#access'] = FALSE;
          break;
        case 'Comment settings':
          $form['comment_settings']['#access'] = FALSE;
          break;
        case 'Menu settings':
          $form['menu']['#access'] = FALSE;
          break;
        case 'URL path settings':
          $form['path']['#access'] = FALSE;
          break;
        case 'Advanced Form block':
          $form['advanced_afb_edit']['#access'] = FALSE;
          break;
        default:
          break;
      }
    }
  }
  return $form;
}