You are here

public function views_plugin_display_block::options_form in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 plugins/views_plugin_display_block.inc \views_plugin_display_block::options_form()
  2. 6.2 plugins/views_plugin_display_block.inc \views_plugin_display_block::options_form()

Provide the default form for setting options.

Overrides views_plugin_display::options_form

File

plugins/views_plugin_display_block.inc, line 132
Definition of views_plugin_display_block.

Class

views_plugin_display_block
The plugin that handles a block.

Code

public function options_form(&$form, &$form_state) {

  // It is very important to call the parent function here.
  parent::options_form($form, $form_state);
  switch ($form_state['section']) {
    case 'block_description':
      $form['#title'] .= t('Block admin description');
      $form['block_description'] = array(
        '#type' => 'textfield',
        '#description' => t('This will appear as the name of this block in administer >> structure >> blocks.'),
        '#default_value' => $this
          ->get_option('block_description'),
      );
      break;
    case 'block_caching':
      $form['#title'] .= t('Block caching type');
      $form['block_caching'] = array(
        '#type' => 'radios',
        '#description' => t("This sets the default status for Drupal's built-in block caching method; this requires that caching be turned on in block administration, and be careful because you have little control over when this cache is flushed."),
        '#options' => $this
          ->block_caching_modes(),
        '#default_value' => $this
          ->get_cache_type(),
      );
      break;
    case 'exposed_form_options':
      $this->view
        ->init_handlers();
      if (!$this
        ->uses_exposed() && parent::uses_exposed()) {
        $form['exposed_form_options']['warning'] = array(
          '#weight' => -10,
          '#markup' => '<div class="messages warning">' . t('Exposed filters in block displays require "Use AJAX" to be set to work correctly.') . '</div>',
        );
      }
      break;
  }
}