You are here

class views_contextual_filters_or_search_api_query in Views Contextual Filters OR 7

Object used to create a SELECT query.

Hierarchy

Expanded class hierarchy of views_contextual_filters_or_search_api_query

1 string reference to 'views_contextual_filters_or_search_api_query'
views_contextual_filters_or_views_plugins_alter in ./views_contextual_filters_or.views.inc
Implements hook_views_plugins_alter().

File

plugins/views_contextual_filters_or_search_api_query.inc, line 11
Defines the alter query object.

View source
class views_contextual_filters_or_search_api_query extends SearchApiViewsQuery {
  function option_definition() {
    $options = parent::option_definition();
    $options['contextual_filters_or'] = array(
      'default' => FALSE,
      'translatable' => FALSE,
      'bool' => TRUE,
    );
    return $options;
  }

  /**
   * Add settings for the ui.
   */
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $form['contextual_filters_or'] = array(
      '#title' => t('Contextual filters OR'),
      '#description' => t('Contextual filters applied to OR logic.'),
      '#type' => 'checkbox',
      '#default_value' => !empty($this->options['contextual_filters_or']),
    );
  }

  /**
   * Builds the necessary info to execute the query.
   */
  public function build(&$view) {
    if (!empty($this->where) && $this->options['contextual_filters_or']) {
      $where = array();
      foreach ($this->where as $group_id => $group) {
        if (empty($group_id) && (!empty($group['conditions']) || !empty($group['filters']))) {
          $group += array(
            'type' => 'OR',
          );
          if ($group_id === '') {
            $group_id = 0;
          }
        }
        $where[$group_id] = $group;
      }
      $this->where = $where;
    }
    parent::build($view);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SearchApiViewsQuery::$abort protected property Whether to abort the search instead of executing it.
SearchApiViewsQuery::$errors protected property Array of all encountered errors.
SearchApiViewsQuery::$fields protected property The names of all fields whose value is required by a handler.
SearchApiViewsQuery::$filters protected property The query's sub-filters representing the different Views filter groups.
SearchApiViewsQuery::$group_operator public property The conjunction with which multiple filter groups are combined.
SearchApiViewsQuery::$index protected property The index this view accesses.
SearchApiViewsQuery::$limit protected property Number of results to display.
SearchApiViewsQuery::$offset protected property Offset of first displayed result.
SearchApiViewsQuery::$query protected property The query that will be executed.
SearchApiViewsQuery::$search_api_results protected property The results returned by the query, after it was executed.
SearchApiViewsQuery::abort public function Aborts this search query.
SearchApiViewsQuery::addField public function Add a field that should be retrieved from the results by this view.
SearchApiViewsQuery::addResults protected function Helper function for adding results to a view in the format expected by the view.
SearchApiViewsQuery::add_orderby public function Provides a sorting method as present in the Views default query plugin.
SearchApiViewsQuery::add_selector_orderby public function Adds a sort to the query.
SearchApiViewsQuery::alter public function Let modules modify the query just prior to finalizing it. Overrides views_plugin_query::alter
SearchApiViewsQuery::condition public function Set a condition on the search query object.
SearchApiViewsQuery::createFilter public function
SearchApiViewsQuery::execute public function Executes the query and fills the associated view object with according values. Overrides views_plugin_query::execute
SearchApiViewsQuery::extractFields protected function Helper function for extracting all necessary fields from a result item.
SearchApiViewsQuery::fields public function
SearchApiViewsQuery::filter public function Adds a nested filter to the search query object.
SearchApiViewsQuery::getFields public function
SearchApiViewsQuery::getFilter public function
SearchApiViewsQuery::getIndex public function
SearchApiViewsQuery::getKeys public function
SearchApiViewsQuery::getOption public function
SearchApiViewsQuery::getOptions public function
SearchApiViewsQuery::getOriginalKeys public function
SearchApiViewsQuery::getSearchApiQuery public function API function for accessing the raw Search API query object.
SearchApiViewsQuery::getSearchApiResults public function API function for accessing the raw Search API results.
SearchApiViewsQuery::getSort public function
SearchApiViewsQuery::get_result_entities public function Returns the according entity objects for the given query results. Overrides views_plugin_query::get_result_entities
SearchApiViewsQuery::get_result_wrappers public function Returns the according metadata wrappers for the given query results.
SearchApiViewsQuery::init public function Create the basic query object and fill with default values. Overrides views_plugin_query::init
SearchApiViewsQuery::keys public function
SearchApiViewsQuery::range public function
SearchApiViewsQuery::setOption public function
SearchApiViewsQuery::sort public function
views_contextual_filters_or_search_api_query::build public function Builds the necessary info to execute the query. Overrides SearchApiViewsQuery::build
views_contextual_filters_or_search_api_query::options_form function Add settings for the ui. Overrides SearchApiViewsQuery::options_form
views_contextual_filters_or_search_api_query::option_definition function Defines the options used by this query plugin. Overrides SearchApiViewsQuery::option_definition
views_object::$definition public property Handler's definition.
views_object::$options public property Except for displays, options for the object will be held here. 1
views_object::altered_option_definition function Collect this handler's option definition and alter them, ready for use.
views_object::construct public function Views handlers use a special construct function. 4
views_object::destroy public function Destructor. 2
views_object::export_option public function 1
views_object::export_options public function
views_object::export_option_always public function Always exports the option, regardless of the default value.
views_object::options Deprecated public function Set default options on this object. 1
views_object::set_default_options public function Set default options.
views_object::set_definition public function Let the handler know what its full definition is.
views_object::unpack_options public function Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.
views_object::unpack_translatable public function Unpack a single option definition.
views_object::unpack_translatables public function Unpacks each handler to store translatable texts.
views_object::_set_option_defaults public function
views_plugin::$display public property The current used views display.
views_plugin::$plugin_name public property The plugin name of this plugin, for example table or full.
views_plugin::$plugin_type public property The plugin type of this plugin, for example style or query.
views_plugin::$view public property The top object of a view. Overrides views_object::$view 1
views_plugin::additional_theme_functions public function Provide a list of additional theme functions for the theme info page.
views_plugin::plugin_title public function Return the human readable name of the display.
views_plugin::theme_functions public function Provide a full list of possible theme templates used by this style.
views_plugin::validate public function Validate that the plugin is correct and can be saved. 3
views_plugin_query::$pager public property A pager plugin that should be provided by the display. 1
views_plugin_query::add_signature public function Add a signature to the query, if such a thing is feasible. 1
views_plugin_query::get_aggregation_info public function Get aggregation info for group by queries. 1
views_plugin_query::options_submit public function Handle any special handling on the validate form. Overrides views_plugin::options_submit 1
views_plugin_query::options_validate public function Validate the options form. Overrides views_plugin::options_validate
views_plugin_query::query public function Generate a query and a countquery from all of the information supplied to the object. Overrides views_plugin::query 1
views_plugin_query::render_pager public function Render the pager, if necessary.
views_plugin_query::set_group_operator public function Control how all WHERE and HAVING groups are put together.
views_plugin_query::set_limit public function Set a LIMIT on the query, specifying a maximum number of results.
views_plugin_query::set_offset public function Set an OFFSET on the query, specifying a number of results to skip
views_plugin_query::set_where_group public function Create a new grouping for the WHERE or HAVING clause.
views_plugin_query::summary_title public function Returns the summary of the settings in the display. Overrides views_plugin::summary_title