1 block.class.inc Block::form(&$form, &$form_state)

Build the settings form for editing this block.

File

core/modules/layout/includes/block.class.inc, line 215
A class that wraps around a block to store settings information.

Class

Block
@file A class that wraps around a block to store settings information.

Code

function form(&$form, &$form_state) {
  $layout = $form_state['layout'];
  $contexts = $layout->getContexts();
  $block_info = $this->getBlockInfo();
  $current_context_settings = isset($this->settings['contexts']) ? $this->settings['contexts'] : array();

  $form['contexts'] = layout_contexts_form_element($contexts, $current_context_settings, $block_info);

  $form['title_display']['#tree'] = FALSE;
  $form['title_display']['title_display'] = array(
    '#type' => 'select',
    '#title' => t('Block title type'),
    '#options' => array(
      LAYOUT_TITLE_DEFAULT => t('Default'),
      LAYOUT_TITLE_CUSTOM => t('Custom'),
      LAYOUT_TITLE_NONE => t('None'),
    ),
    '#default_value' => $this->settings['title_display'],
  );
  $form['title_display']['title'] = array(
    '#type' => 'textfield',
    '#default_value' => $this->settings['title'],
    '#title' => t('Custom title'),
    '#states' => array(
      'visible' => array(
        'form.layout-block-configure-form :input[name="title_display"]' => array('value' => LAYOUT_TITLE_CUSTOM),
      ),
    ),
    '#maxlength' => 255,
  );
}