1 block_example.module block_example_block_configure($delta = '', $settings = array())

Implements hook_block_configure().

This hook declares configuration options for blocks provided by this module.

Related topics

File

modules/examples/block_example/block_example.module, line 99
Module file for block_example.

Code

function block_example_block_configure($delta = '', $settings = array()) {
  $form = array();
  // The $delta parameter tells us which block is being configured.
  // In this example, we'll allow the administrator to customize
  // the text of the 'configurable text string' block defined in this module.
  if ($delta == 'example_configurable_text') {
    // Add in default values to the settings array.
    $settings += array(
      'example_string' => '',
      'uppercase' => '',
    );
    // All we need to provide is the specific configuration options for our
    // block. Backdrop will take care of the standard block configuration options
    // (block title, page visibility, etc.) and the save button.
    $form['example_string'] = array(
      '#type' => 'textfield',
      '#title' => t('Block contents'),
      '#size' => 60,
      '#description' => t('This text will appear in the example block.'),
      '#default_value' => $settings['example_string'],
    );
    $form['uppercase'] = array(
      '#type' => 'checkbox',
      '#title' => t('Uppercase the block contents'),
      '#default_value' => $settings['uppercase'],
    );
  }

  return $form;
}