You are here

class views_plugin_exposed_form_input_required in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 7.3 plugins/views_plugin_exposed_form_input_required.inc \views_plugin_exposed_form_input_required

Exposed form plugin that provides basic exposed form

Hierarchy

Expanded class hierarchy of views_plugin_exposed_form_input_required

1 string reference to 'views_plugin_exposed_form_input_required'
views_views_plugins in includes/plugins.inc
Implementation of hook_views_plugins

File

plugins/views_plugin_exposed_form_input_required.inc, line 6

View source
class views_plugin_exposed_form_input_required extends views_plugin_exposed_form {
  function summary_title() {
    return t('Input required');
  }
  function option_definition() {
    $options = parent::option_definition();
    $options['text_input_required'] = array(
      'default' => t('Select any filter and click on Apply to see results'),
      'translatable' => TRUE,
    );
    $options['text_input_required_format'] = array(
      'default' => FILTER_FORMAT_DEFAULT,
    );
    return $options;
  }
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $form['text_input_required'] = array(
      '#type' => 'textarea',
      '#title' => t('Text on demand'),
      '#description' => t('Text to display instead of results until the user selects and applies an exposed filter.'),
      '#default_value' => $this->options['text_input_required'],
    );
    $form['text_input_required_format'] = filter_form($this->options['text_input_required_format'], NULL, array(
      'text_input_required_format',
    ));
  }
  function options_submit($form, &$form_state) {
    $form_state['values']['exposed_form_options']['text_input_required_format'] = $form_state['values']['text_input_required_format'];
    parent::options_submit($form, $form_state);
  }
  function exposed_filter_applied() {
    static $cache = NULL;
    if (!isset($cache)) {
      $view = $this->view;
      if (is_array($view->filter) && count($view->filter)) {
        foreach ($view->filter as $filter_id => $filter) {
          if ($filter
            ->is_exposed()) {
            $identifier = $filter->options['expose']['identifier'];
            if (isset($view->exposed_input[$identifier])) {
              $cache = TRUE;
              return $cache;
            }
          }
        }
      }
      $cache = FALSE;
    }
    return $cache;
  }
  function pre_render(&$values) {
    if (!$this
      ->exposed_filter_applied()) {
      $options = array(
        'id' => 'area',
        'table' => 'views',
        'field' => 'area',
        'label' => '',
        'relationship' => 'none',
        'group_type' => 'group',
        'content' => $this->options['text_input_required'],
        'format' => $this->options['text_input_required_format'],
      );
      $handler = views_get_handler('views', 'area', 'area');
      $handler
        ->init($this->view, $options);
      $this->display->handler->handlers['empty'] = array(
        'area' => $handler,
      );
      $this->display->handler
        ->set_option('empty', array(
        'text' => $options,
      ));
    }
  }
  function query() {
    if (!$this
      ->exposed_filter_applied()) {

      // We return with no query; this will force the empty text.
      $this->view->built = TRUE;
      $this->view->executed = TRUE;
      $this->view->result = array();
    }
    else {
      parent::query();
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
views_object::$definition property Handler's definition
views_object::$options property Except for displays, options for the object will be held here. 1
views_object::construct function Views handlers use a special construct function so that we can more easily construct them with variable arguments. 6
views_object::destroy function 2
views_object::export_option function 1
views_object::export_options function
views_object::options function Set default options on this object. Called by the constructor in a complex chain to deal with backward compatibility. 1
views_object::set_default_options function Set default options. For backward compatibility, it sends the options array; this is a feature that will likely disappear at some point.
views_object::set_definition function Let the handler know what its full definition is.
views_object::unpack_options function Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.
views_object::unpack_translatable function Unpack a single option definition.
views_object::unpack_translatables function Unpacks each handler to store translatable texts.
views_object::_set_option_defaults function
views_plugin::$display property The current used views display.
views_plugin::$plugin_type property The plugin type of this plugin, for example style or query.
views_plugin::$view property The top object of a view. Overrides views_object::$view 1
views_plugin::additional_theme_functions function Provide a list of additional theme functions for the theme information page
views_plugin::options_validate function Validate the options form. 8
views_plugin::theme_functions function Provide a full list of possible theme templates used by this style.
views_plugin::validate function Validate that the plugin is correct and can be saved. 2
views_plugin_exposed_form::exposed_form_alter function
views_plugin_exposed_form::exposed_form_submit function This function is executed when exposed form is submited.
views_plugin_exposed_form::exposed_form_validate function
views_plugin_exposed_form::init function Initialize the plugin.
views_plugin_exposed_form::post_render function
views_plugin_exposed_form::pre_execute function
views_plugin_exposed_form::render_exposed_form function Render the exposed filter form.
views_plugin_exposed_form::reset_form function Provide a reset form if one was requested.
views_plugin_exposed_form_input_required::exposed_filter_applied function
views_plugin_exposed_form_input_required::options_form function Provide a form to edit options for this plugin. Overrides views_plugin_exposed_form::options_form
views_plugin_exposed_form_input_required::options_submit function Handle any special handling on the validate form. Overrides views_plugin::options_submit
views_plugin_exposed_form_input_required::option_definition function Information about options for all kinds of purposes will be held here. Overrides views_plugin_exposed_form::option_definition
views_plugin_exposed_form_input_required::pre_render function Overrides views_plugin_exposed_form::pre_render
views_plugin_exposed_form_input_required::query function Add anything to the query that we might need to. Overrides views_plugin_exposed_form::query
views_plugin_exposed_form_input_required::summary_title function Return a string to display as the clickable title for the control. Overrides views_plugin_exposed_form::summary_title