You are here

function afb_configure_node_add_block in Advanced Form Block 7

Presents the node add type blocks settings form.

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

File

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

Code

function afb_configure_node_add_block($delta) {
  $block_info = afb_get_node_form_block_data($delta);
  $type = $block_info->content_type;
  $fields = field_info_instances("node", $type);
  foreach ($fields as $key => $value) {
    if ($value['required'] != TRUE) {
      $field_options[] = $key;
    }
  }
  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'];
  $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;
}