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 243
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) {
  /* @var Layout $layout */
  $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,
  );
  $actions_weight = $form['actions']['#weight'];
  $form['admin_label'] = array(
    '#type' => 'fieldset',
    '#title' => t('Admin label'),
    '#tree' => FALSE,
    '#collapsed' => empty($this->settings['admin_label']),
    '#collapsible' => TRUE,
    '#weight' => $actions_weight - 1,
    '#access' => $this->module != 'block',
  );
  $form['admin_label']['admin_label'] = array(
    '#type' => 'textfield',
    '#default_value' => isset($this->settings['admin_label']) ? $this->settings['admin_label'] : '',
    '#title' => t('Admin label'),
    '#description' => t('Used to identify the block on layout pages.'),
    '#maxlength' => 255,
  );
  $form['admin_label']['admin_description'] = array(
    '#type' => 'textfield',
    '#title' => t('Admin description'),
    '#default_value' => isset($this->settings['admin_description']) ? $this->settings['admin_description'] : '',
    '#maxlength' => 128,
    '#description' => t('This text is used only in administrative interfaces. It will not be shown to site visitors.<br />Allowed HTML tags: @tags', array('@tags' => _filter_xss_display_allowed_tags())),
  );
}