You are here

function nodeblock_block_configure in Nodeblock 7

Implements hook_block_configure().

File

./nodeblock.module, line 841
Enables use of specified node types as custom blocks.

Code

function nodeblock_block_configure($delta = '') {
  $form = array();
  $node = nodeblock_load_nodeblock($delta);
  if ($node) {
    $view_modes = array();
    $view_modes['node_block_default'] = t('Default');
    $view_modes += nodeblock_get_view_modes($node->type);
    $options = array(
      'node_block_default' => t('Default'),
      '0' => t('Hide'),
      '1' => t('Show'),
    );

    // Add a Node Block Group.
    $form['nodeblock'] = array(
      '#type' => 'fieldset',
      '#title' => t('Node Block Settings'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
      '#attributes' => array(
        'class' => array(
          'node-block-settings',
        ),
      ),
      '#weight' => 0,
      'view_mode' => array(
        '#type' => 'select',
        '#options' => $view_modes,
        '#title' => t('View mode'),
        '#default_value' => $node->nodeblock['view_mode'],
        '#group' => 'nodeblock',
      ),
      'node_link' => array(
        '#type' => 'select',
        '#options' => $options,
        '#default_value' => $node->nodeblock['node_link'],
        '#title' => t('Node Link Display'),
        '#group' => 'nodeblock',
      ),
    );
    if (module_exists('comment')) {
      $form['nodeblock']['comment_link'] = array(
        '#type' => 'select',
        '#options' => $options,
        '#default_value' => $node->nodeblock['comment_link'],
        '#title' => t('Node Comments Display'),
        '#group' => 'nodeblock',
      );
    }
  }
  return $form;
}