You are here

function afb_configure_node_edit_block in Advanced Form Block 7

Presents the node edit type blocks settings form.

1 call to afb_configure_node_edit_block()
afb_block_configure in ./afb.module
Implements hook_block_configure().

File

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

Code

function afb_configure_node_edit_block($delta) {
  $block_info = afb_get_node_form_block_data($delta);
  $nid = $block_info->nid;
  $node = node_load($nid);
  $node->ajax_form = 1;
  $fields = field_info_instances("node", $node->type);
  foreach ($fields as $key => $value) {
    $field_options[] = t($key);
  }
  $field_options[] = 'title';
  module_load_include('inc', 'node', 'node.pages');
  $vertical_tab_options = array(
    t('Revision information'),
    t('Authoring information'),
    t('Publishing options'),
    t('Comment settings'),
    t('Menu settings'),
    t('URL path settings'),
  );
  $block_detail_array = afb_get_node_form_block_data($delta);
  $block_detail_data = unserialize($block_detail_array->data);
  $fields = empty($block_detail_data['node_fields']) ? $field_options : $block_detail_data['node_fields'];
  $tabs = empty($block_detail_data['vertical_tabs']) ? $vertical_tab_options : $block_detail_data['vertical_tabs'];
  $vertical_tab_default = variable_get('vertical_tabs_selection_' . $node->nid, '');
  $form['node_fields'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Select the fields you want to keep in the block'),
    '#options' => drupal_map_assoc($field_options),
    '#default_value' => $fields,
  );
  $form['vertical_tabs'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Select the vertical tab components you want to keep in the block'),
    '#options' => drupal_map_assoc($vertical_tab_options),
    '#default_value' => $tabs,
  );
  return $form;
}