You are here

function headerimage_settings_block_add in Header image 5

Same name and namespace in other branches
  1. 6 headerimage.admin.inc \headerimage_settings_block_add()
  2. 7 headerimage.admin.inc \headerimage_settings_block_add()

Overview of all image blocks

1 string reference to 'headerimage_settings_block_add'
headerimage_menu in ./headerimage.module
Implementation of hook_menu()

File

./headerimage.module, line 74
headerimage.module Conditionally display an node in a block.

Code

function headerimage_settings_block_add() {
  $blocks = headerimage_get_blocks();

  // Table of image sets
  $rows = array();
  foreach ($blocks as $delta => $block) {
    $rows[] = array(
      'name' => check_plain($block),
      'edit' => l(t('Edit'), "admin/settings/headerimage/edit/{$delta}"),
      'delete' => l(t('Delete'), "admin/settings/headerimage/delete/{$delta}"),
      'block' => l(t('Configure block'), "admin/build/block/configure/headerimage/{$delta}"),
    );
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No Header Image blocks available.'),
        'colspan' => '4',
      ),
    );
  }
  $header = array(
    t('Name'),
    array(
      'data' => t('Operation'),
      'colspan' => '3',
    ),
  );
  $output = theme('table', $header, $rows, array(
    'id' => 'imageblock',
  ));
  $form = array();
  $form['list'] = array(
    '#type' => 'fieldset',
    '#title' => t('Header Image blocks'),
  );
  $form['list']['table'] = array(
    '#prefix' => '<div>',
    '#value' => $output,
    '#suffix' => '</div>',
  );
  $form['block'] = array(
    '#type' => 'fieldset',
    '#title' => t('Add Header Image block'),
  );
  $form['block']['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Block title'),
    '#description' => t('A block with this same name will be created. Header Image nodes assigned to this block will be displayed in it.'),
    '#default_value' => '',
    '#required' => true,
  );
  $form['block']['op'] = array(
    '#type' => 'submit',
    '#value' => t('Add block'),
  );
  return $form;
}