function node_form_block_admin_configure_alter

Implements hook_form_FORM_ID_alter() for block_admin_configure().

Adds node-type specific visibility options to block configuration form.

See also

node_form_block_admin_configure_submit()

1 call to node_form_block_admin_configure_alter()

File

drupal/core/modules/node/node.module, line 2065
The core module that allows content to be submitted to the site.

Code

function node_form_block_admin_configure_alter(&$form, &$form_state) {
  $default_type_options = db_query("SELECT type FROM {block_node_type} WHERE module = :module AND delta = :delta", array(
    ':module' => $form['module']['#value'],
    ':delta' => $form['delta']['#value'],
  ))
    ->fetchCol();
  $form['visibility']['node_type'] = array(
    '#type' => 'details',
    '#title' => t('Content types'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'visibility',
    '#weight' => 5,
  );
  $form['visibility']['node_type']['types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Show block for specific content types'),
    '#default_value' => $default_type_options,
    '#options' => node_type_get_names(),
    '#description' => t('Show this block only on pages that display content of the given type(s). If you select no types, there will be no type-specific limitation.'),
  );
  $form['#submit'][] = 'node_form_block_admin_configure_submit';
}