block_custom_block_form

7 block.module block_custom_block_form($edit = array())
8 block.module block_custom_block_form($edit = array())

Form constructor for the custom block form.

Parameters

$edit: (optional) An associative array of information retrieved by block_custom_get_block() if an existing block is being edited, or an empty array otherwise. Defaults to array().

Related topics

1 call to block_custom_block_form()

File

modules/block/block.module, line 503
Controls the visual building blocks a page is constructed with.

Code

function block_custom_block_form($edit = array()) {
  $edit += array(
    'info' => '', 
    'body' => '',
  );
  $form['info'] = array(
    '#type' => 'textfield', 
    '#title' => t('Block description'), 
    '#default_value' => $edit['info'], 
    '#maxlength' => 64, 
    '#description' => t('A brief description of your block. Used on the <a href="@overview">Blocks administration page</a>.', array('@overview' => url('admin/structure/block'))), 
    '#required' => TRUE, 
    '#weight' => -18,
  );
  $form['body_field']['#weight'] = -17;
  $form['body_field']['body'] = array(
    '#type' => 'text_format', 
    '#title' => t('Block body'), 
    '#default_value' => $edit['body'], 
    '#format' => isset($edit['format']) ? $edit['format'] : NULL, 
    '#rows' => 15, 
    '#description' => t('The content of the block as shown to the user.'), 
    '#required' => TRUE, 
    '#weight' => -17,
  );

  return $form;
}
Login or register to post comments