You are here

class ElasticsearchViewsQuery in Elasticsearch Connector 8.5

Same name and namespace in other branches
  1. 8.7 modules/elasticsearch_connector_views/src/Plugin/views/query/ElasticsearchViewsQuery.php \Drupal\elasticsearch_connector_views\Plugin\views\query\ElasticsearchViewsQuery
  2. 8.2 modules/elasticsearch_connector_views/src/Plugin/views/query/ElasticsearchViewsQuery.php \Drupal\elasticsearch_connector_views\Plugin\views\query\ElasticsearchViewsQuery
  3. 8.6 modules/elasticsearch_connector_views/src/Plugin/views/query/ElasticsearchViewsQuery.php \Drupal\elasticsearch_connector_views\Plugin\views\query\ElasticsearchViewsQuery

Defines a Views query class for searching on Search API indexes.

Plugin annotation


@ViewsQuery(
  id = "elasticsearch_connector_views_query",
  title = @Translation("Elasticsearch Connector Views Query"),
  help = @Translation("The query will be generated and run using the
  Elasticsearch API.")
)

Hierarchy

Expanded class hierarchy of ElasticsearchViewsQuery

File

modules/elasticsearch_connector_views/src/Plugin/views/query/ElasticsearchViewsQuery.php, line 27

Namespace

Drupal\elasticsearch_connector_views\Plugin\views\query
View source
class ElasticsearchViewsQuery extends QueryPluginBase {

  /**
   * Number of results to display.
   *
   * @var int
   */
  protected $limit;

  /**
   * Offset of first displayed result.
   *
   * @var int
   */
  protected $offset;

  /**
   * The Elasticsearch index name.
   *
   * @var string
   */
  protected $index;

  /**
   * Elasticsearch types to be fetched.
   *
   * @var array
   */
  protected $elasticsearchTypes;

  /**
   * @var Cluster
   */
  protected $elasticsearchCluster;

  /**
   * The query that will be executed.
   *
   * @var \nodespark\DESConnector\ClientInterface
   */
  protected $elasticsearchClient;

  /**
   * Array of all encountered errors.
   *
   * Each of these is fatal, meaning that a non-empty $errors property will
   * result in an empty result being returned.
   *
   * @var array
   */
  protected $errors = array();

  /**
   * Whether to abort the search instead of executing it.
   *
   * @var bool
   */
  protected $abort = FALSE;

  /**
   * The properties that should be retrieved from result items.
   *
   * The array is keyed by datasource ID (which might be NULL) and property
   * path, the values are the associated combined property paths.
   *
   * @var string[][]
   */
  protected $retrievedProperties = array();

  /**
   * The query's conditions representing the different Views filter groups.
   *
   * @var array
   */
  protected $conditions = array();

  /**
   * The conjunction with which multiple filter groups are combined.
   *
   * @var string
   */
  protected $groupOperator = 'AND';

  /**
   * The logger to use for log messages.
   *
   * @var \Psr\Log\LoggerInterface|null
   */
  protected $logger;

  /**
   * The entity type manager service.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {

    /** @var static $plugin */
    $plugin = parent::create($container, $configuration, $plugin_id, $plugin_definition);

    /** @var \Psr\Log\LoggerInterface $logger */
    $logger = $container
      ->get('logger.factory')
      ->get('elasticsearch_connector_views');
    $plugin
      ->setLogger($logger);
    $entity_type_manager = $container
      ->get('entity_type.manager');
    $plugin
      ->setEntityTypeManager($entity_type_manager);
    return $plugin;
  }

  /**
   * Retrieves the logger to use for log messages.
   *
   * @return \Psr\Log\LoggerInterface
   *   The logger to use.
   */
  public function getLogger() {
    return $this->logger ?: \Drupal::logger('elasticsearch_connector_views');
  }

  /**
   * Sets the logger to use for log messages.
   *
   * @param \Psr\Log\LoggerInterface $logger
   *   The new logger.
   *
   * @return $this
   */
  public function setLogger(LoggerInterface $logger) {
    $this->logger = $logger;
    return $this;
  }

  /**
   * Sets the entity type manager service.
   *
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager service.
   */
  public function setEntityTypeManager(EntityTypeManagerInterface $entity_type_manager) {
    $this->entityTypeManager = $entity_type_manager;
  }

  /**
   * {@inheritdoc}
   */
  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
    try {
      parent::init($view, $display, $options);
      $view_id = $this->view->storage
        ->get('base_table');
      $data = Views::viewsData()
        ->get($view_id);
      $cluster_id = $data['table']['base']['cluster_id'];
      $this->index = $data['table']['base']['index'];
      $this->elasticsearchTypes[$data['table']['base']['type']] = $data['table']['base']['type'];
      $this->elasticsearchCluster = $this->entityTypeManager
        ->getStorage('elasticsearch_cluster')
        ->load($cluster_id);
      $clientManager = \Drupal::service('elasticsearch_connector.client_manager');
      $this->elasticsearchClient = $clientManager
        ->getClientForCluster($this->elasticsearchCluster);
    } catch (\Exception $e) {
      $this
        ->abort($e
        ->getMessage());
    }
  }

  /**
   * @param $table
   *   Table name.
   * @param $field
   *   Field name.
   * @param string $alias
   *   Alias.
   * @param array $params
   *   Params array.
   */
  public function addField($table, $field, $alias = '', $params = array()) {
    $this->fields[$field] = $field;
  }

  /**
   * Ensure a table exists in the queue; if it already exists it won't
   * do anything, but if it does not it will add the table queue. It will ensure
   * a path leads back to the relationship table.
   *
   * @param $table
   *   The not aliased name of the table to ensure.
   * @param $relationship
   *   The relationship to ensure the table links to. Each relationship will
   *   get a unique instance of the table being added. If not specified,
   *   will be the primary table.
   * @param \Drupal\views\Plugin\views\join\JoinPluginBase $join
   *   A Join object (or derived object) to join the alias in.
   *
   * @return
   *   The alias used to refer to this specific table, or NULL if the table
   *   cannot be ensured.
   */
  public function ensureTable($table, $relationship = NULL, JoinPluginBase $join = NULL) {

    // TODO: Read the documentation about this.
    return NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function defineOptions() {
    return parent::defineOptions() + array(
      'bypass_access' => array(
        'default' => FALSE,
      ),
      'skip_access' => array(
        'default' => FALSE,
      ),
      'parse_mode' => array(
        'default' => 'terms',
      ),
    );
  }

  /**
   * {@inheritdoc}
   */
  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);
    $form['bypass_access'] = array(
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Bypass access checks'),
      '#description' => $this
        ->t('If the underlying search index has access checks enabled (e.g., through the "Content access" processor), this option allows you to disable them for this view. This will never disable any filters placed on this view.'),
      '#default_value' => $this->options['bypass_access'],
    );
    if ($this
      ->getEntityTypes(TRUE)) {
      $form['skip_access'] = array(
        '#type' => 'checkbox',
        '#title' => $this
          ->t('Skip entity access checks'),
        '#description' => $this
          ->t("By default, an additional access check will be executed for each entity returned by the search query. However, since removing results this way will break paging and result counts, it is preferable to configure the view in a way that it will only return accessible results. If you are sure that only accessible results will be returned in the search, or if you want to show results to which the user normally wouldn't have access, you can enable this option to skip those additional access checks. This should be used with care."),
        '#default_value' => $this->options['skip_access'],
        '#weight' => -1,
      );
      $form['bypass_access']['#states']['visible'][':input[name="query[options][skip_access]"]']['checked'] = TRUE;
    }

    // @todo Move this setting to the argument and filter plugins where it makes
    //   more sense for users.
    $form['parse_mode'] = array(
      '#type' => 'select',
      '#title' => $this
        ->t('Parse mode'),
      '#description' => $this
        ->t('Choose how the search keys will be parsed.'),
      '#options' => array(),
      '#default_value' => $this->options['parse_mode'],
    );

    //    foreach ($this->query->parseModes() as $key => $mode) {
    //      $form['parse_mode']['#options'][$key] = $mode['name'];
    //      if (!empty($mode['description'])) {
    //        $states['visible'][':input[name="query[options][parse_mode]"]']['value'] = $key;
    //        $form["parse_mode_{$key}_description"] = array(
    //          '#type' => 'item',
    //          '#title' => $mode['name'],
    //          '#description' => $mode['description'],
    //          '#states' => $states,
    //        );
    //      }
    //    }
  }

  /**
   * {@inheritdoc}
   */
  public function build(ViewExecutable $view) {
    $this->view = $view;

    // Store the view in the object to be able to use it later.
    $this->view = $view;
    $view
      ->initPager();

    // Let the pager modify the query to add limits.
    $view->pager
      ->query();
    if ($this
      ->shouldAbort()) {
      return;
    }

    // Set aliases of the fields.
    foreach ($view->field as $field_name => &$field) {
      $field->field_alias = $field_name;
      $field->aliases['entity_type'] = 'entity_type';
    }

    // Add fields to the query so they will be shown in solr document.
    $this->params['fields'] = array_keys($view->field);
    $this->params['fields'][] = '_source';
    $params = array();
    $params['size'] = $view->pager
      ->getItemsPerPage();
    $params['from'] = $view->pager
      ->getCurrentPage() * $view->pager
      ->getItemsPerPage();

    // If we display all items without pager remove the size limit to return
    // all documents from elasticsearch.
    if ($params['size'] == 0) {
      unset($params['size']);
    }

    // Add fields.
    // We are specifying which fields to be visible!
    $params['_source'] = array();
    if (isset($this->params['fields'])) {
      $params['_source'] = array_merge($params['_source'], $this->params['fields']);
    }
    if (!empty($this->where['conditions'])) {
      $params['query'] = [
        'bool' => [
          'must' => [
            'match' => $this->where['conditions'],
          ],
        ],
      ];
    }

    // Add sorting.
    if (!empty($this->sort_fields)) {
      $params['sort'] = $this
        ->buildSortArray();
    }
    $this->query_params = $params;

    // Export parameters for preview.
    $view->build_info['query'] = var_export($params, TRUE);
  }

  /**
   * @return array
   */
  protected function buildSortArray() {
    $sort = array();
    foreach ($this->sort_fields as $field => $order) {
      $sort[] = array(
        $field => $order,
      );
    }
    return $sort;
  }

  /**
   * Build the filter parameters for Elasticsearch.
   *
   * @param array $where
   *   All where causes for the query.
   *
   * @return array
   *   The ready to use filters in Elasticsearch body.
   */
  protected function buildFilterArray($where) {
    $filter = array();
    foreach ($where as $wh) {
      foreach ($wh['conditions'] as $cond) {
        $filter[Unicode::strtolower($wh['type'])][] = $cond['field'];
      }
    }
    if (count($filter) > 1) {
      $filter = array(
        Unicode::strtolower($this->group_operator) => $filter,
      );
    }
    return $filter;
  }

  /**
   * {@inheritdoc}
   */
  public function alter(ViewExecutable $view) {
    \Drupal::moduleHandler()
      ->invokeAll('views_query_alter', array(
      $view,
      $this,
    ));
  }

  /**
   * {@inheritdoc}
   */
  public function execute(ViewExecutable $view) {
    $view->result = array();
    $view->total_rows = 0;
    $view->execute_time = 0;
    $index = $this
      ->getIndex();
    $type = $this
      ->getSearchTypes();
    try {
      $start = microtime(TRUE);
      $client = $this->elasticsearchClient;
      if ($client) {
        $view->execute_time = microtime(TRUE) - $start;
      }

      // Execute the search.
      $response = $client
        ->search(array(
        'index' => $index,
        'type' => $type,
        'body' => $this->query_params,
      ))
        ->getRawResponse();

      // Store results.
      if (!empty($response['hits']['hits'])) {
        $item_index = 0;
        foreach ($response['hits']['hits'] as $doc) {
          $result_doc = array();
          foreach ($doc['_source'] as $field_name => $field_value) {
            if (is_array($field_value)) {

              // TODO: Handle this by implementing the Multivalue interface in D8
              // Handle multivalue with concatenation for now.
              $result_doc[$field_name] = implode(' | ', $field_value);
            }
            else {
              $result_doc[$field_name] = $field_value;
            }
          }
          $result_doc['_source'] = $doc['_source'];
          $result_doc['index'] = $item_index;
          $view->result[] = new ResultRow($result_doc);

          // Increment the index item.
          $item_index++;
        }
      }

      // $view->result = iterator_to_array($view->result);
      // Store the results.
      $view->pager->total_items = $view->total_rows = $response['hits']['total'];
      $view->pager
        ->updatePageInfo();

      // We shouldn't use $results['performance']['complete'] here, since
      // extracting the results probably takes considerable time as well.
      $view->execute_time = $response['took'];
    } catch (\Exception $e) {
      $this->errors[] = $e
        ->getMessage();
    }
    if ($this->errors) {
      foreach ($this->errors as $msg) {
        drupal_set_message($msg, 'error');
      }
      $view->result = array();
      $view->total_rows = 0;
      $view->execute_time = 0;
    }
  }

  /**
   * Aborts this search query.
   *
   * Used by handlers to flag a fatal error which should not be displayed but
   * still lead to the view returning empty and the search not being executed.
   *
   * @param string|null $msg
   *   Optionally, a translated, unescaped error message to display.
   */
  public function abort($msg = NULL) {
    if ($msg) {
      $this->errors[] = $msg;
    }
    $this->abort = TRUE;
  }

  /**
   * Checks whether this query should be aborted.
   *
   * @return bool
   *   TRUE if the query should/will be aborted, FALSE otherwise.
   *
   * @see SearchApiQuery::abort()
   */
  public function shouldAbort() {
    return $this->abort;
  }

  /**
   * Retrieves the account object to use for access checks for this query.
   *
   * @return \Drupal\Core\Session\AccountInterface|null
   *   The account for which to check access to returned or displayed entities.
   *   Or NULL to use the currently logged-in user.
   */
  public function getAccessAccount() {

    //    $account = $this->getOption('elasticsearch_connector_views_access_account');
    //    if ($account && is_scalar($account)) {
    //      $account = User::load($account);
    //    }
    return FALSE;
  }

  /**
   * Returns the Search API query object used by this Views query.
   *
   * @return null
   *   The search query object used internally by this plugin, if any has been
   *   successfully created. NULL otherwise.
   */
  public function getSearchApiQuery() {
    return $this->query;
  }

  /**
   * {@inheritdoc}
   */
  public function calculateDependencies() {
    $dependencies = parent::calculateDependencies();
    return $dependencies;
  }

  /**
   * Retrieves the index associated with this search.
   *
   * @return string
   *   The index this query should be executed on.
   */
  public function getIndex() {
    return $this->index;
  }

  /**
   *
   */
  public function getClusterId() {
    return $this->elasticsearchCluster->cluster_id;
  }

  /**
   *
   */
  public function getSearchTypes() {
    return implode(',', $this->elasticsearchTypes);
  }

  /**
   *
   */
  public function getElasticsearchClient() {
    return $this->elasticsearchClient;
  }

  /**
   * // TODO: Comment.
   *
   * @param $table
   * @param null $field
   * @param string $order
   * @param string $alias
   * @param array $params
   */
  public function addOrderBy($table, $field = NULL, $order = 'ASC', $alias = '', $params = array()) {

    // TODO: Implement the addOrderBy method.
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
ElasticsearchViewsQuery::$abort protected property Whether to abort the search instead of executing it.
ElasticsearchViewsQuery::$conditions protected property The query's conditions representing the different Views filter groups.
ElasticsearchViewsQuery::$elasticsearchClient protected property The query that will be executed.
ElasticsearchViewsQuery::$elasticsearchCluster protected property
ElasticsearchViewsQuery::$elasticsearchTypes protected property Elasticsearch types to be fetched.
ElasticsearchViewsQuery::$entityTypeManager protected property The entity type manager service.
ElasticsearchViewsQuery::$errors protected property Array of all encountered errors.
ElasticsearchViewsQuery::$groupOperator protected property The conjunction with which multiple filter groups are combined.
ElasticsearchViewsQuery::$index protected property The Elasticsearch index name.
ElasticsearchViewsQuery::$limit protected property Number of results to display. Overrides QueryPluginBase::$limit
ElasticsearchViewsQuery::$logger protected property The logger to use for log messages.
ElasticsearchViewsQuery::$offset protected property Offset of first displayed result.
ElasticsearchViewsQuery::$retrievedProperties protected property The properties that should be retrieved from result items.
ElasticsearchViewsQuery::abort public function Aborts this search query.
ElasticsearchViewsQuery::addField public function
ElasticsearchViewsQuery::addOrderBy public function // TODO: Comment.
ElasticsearchViewsQuery::alter public function Let modules modify the query just prior to finalizing it. Overrides QueryPluginBase::alter
ElasticsearchViewsQuery::build public function Builds the necessary info to execute the query. Overrides QueryPluginBase::build
ElasticsearchViewsQuery::buildFilterArray protected function Build the filter parameters for Elasticsearch.
ElasticsearchViewsQuery::buildOptionsForm public function Provide a form to edit options for this plugin. Overrides PluginBase::buildOptionsForm
ElasticsearchViewsQuery::buildSortArray protected function
ElasticsearchViewsQuery::calculateDependencies public function Calculates dependencies for the configured plugin. Overrides QueryPluginBase::calculateDependencies
ElasticsearchViewsQuery::create public static function Creates an instance of the plugin. Overrides PluginBase::create
ElasticsearchViewsQuery::defineOptions public function Information about options for all kinds of purposes will be held here. Overrides PluginBase::defineOptions
ElasticsearchViewsQuery::ensureTable public function Ensure a table exists in the queue; if it already exists it won't do anything, but if it does not it will add the table queue. It will ensure a path leads back to the relationship table.
ElasticsearchViewsQuery::execute public function Executes the query and fills the associated view object with according values. Overrides QueryPluginBase::execute
ElasticsearchViewsQuery::getAccessAccount public function Retrieves the account object to use for access checks for this query.
ElasticsearchViewsQuery::getClusterId public function
ElasticsearchViewsQuery::getElasticsearchClient public function
ElasticsearchViewsQuery::getIndex public function Retrieves the index associated with this search.
ElasticsearchViewsQuery::getLogger public function Retrieves the logger to use for log messages.
ElasticsearchViewsQuery::getSearchApiQuery public function Returns the Search API query object used by this Views query.
ElasticsearchViewsQuery::getSearchTypes public function
ElasticsearchViewsQuery::init public function Initialize the plugin. Overrides PluginBase::init
ElasticsearchViewsQuery::setEntityTypeManager public function Sets the entity type manager service.
ElasticsearchViewsQuery::setLogger public function Sets the logger to use for log messages.
ElasticsearchViewsQuery::shouldAbort public function Checks whether this query should be aborted.
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$definition public property Plugins's definition
PluginBase::$displayHandler public property The display object this plugin is for.
PluginBase::$options public property Options for this plugin will be held here.
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::$renderer protected property Stores the render API renderer. 3
PluginBase::$usesOptions protected property Denotes whether the plugin has an additional options form. 8
PluginBase::$view public property The top object of a view. 1
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::destroy public function Clears a plugin. Overrides ViewsPluginInterface::destroy 2
PluginBase::doFilterByDefinedOptions protected function Do the work to filter out stored options depending on the defined options.
PluginBase::filterByDefinedOptions public function Filter out stored options depending on the defined options. Overrides ViewsPluginInterface::filterByDefinedOptions
PluginBase::getAvailableGlobalTokens public function Returns an array of available token replacements. Overrides ViewsPluginInterface::getAvailableGlobalTokens
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::getProvider public function Returns the plugin provider. Overrides ViewsPluginInterface::getProvider
PluginBase::getRenderer protected function Returns the render API renderer. 1
PluginBase::globalTokenForm public function Adds elements for available core tokens to a form. Overrides ViewsPluginInterface::globalTokenForm
PluginBase::globalTokenReplace public function Returns a string with any core tokens replaced. Overrides ViewsPluginInterface::globalTokenReplace
PluginBase::INCLUDE_ENTITY constant Include entity row languages when listing languages.
PluginBase::INCLUDE_NEGOTIATED constant Include negotiated languages when listing languages.
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::listLanguages protected function Makes an array of languages, optionally including special languages.
PluginBase::pluginTitle public function Return the human readable name of the display. Overrides ViewsPluginInterface::pluginTitle
PluginBase::preRenderAddFieldsetMarkup public static function Moves form elements into fieldsets for presentation purposes. Overrides ViewsPluginInterface::preRenderAddFieldsetMarkup
PluginBase::preRenderFlattenData public static function Flattens the structure of form elements. Overrides ViewsPluginInterface::preRenderFlattenData
PluginBase::queryLanguageSubstitutions public static function Returns substitutions for Views queries for languages.
PluginBase::setOptionDefaults protected function Fills up the options of the plugin with defaults.
PluginBase::themeFunctions public function Provide a full list of possible theme templates used by this style. Overrides ViewsPluginInterface::themeFunctions 1
PluginBase::trustedCallbacks public static function Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface::trustedCallbacks 6
PluginBase::unpackOptions public function Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. Overrides ViewsPluginInterface::unpackOptions
PluginBase::usesOptions public function Returns the usesOptions property. Overrides ViewsPluginInterface::usesOptions 8
PluginBase::validate public function Validate that the plugin is correct and can be saved. Overrides ViewsPluginInterface::validate 6
PluginBase::viewsTokenReplace protected function Replaces Views' tokens in a given string. The resulting string will be sanitized with Xss::filterAdmin. 1
PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT constant Query string to indicate the site default language.
PluginBase::__construct public function Constructs a PluginBase object. Overrides PluginBase::__construct
QueryPluginBase::$pager public property A pager plugin that should be provided by the display.
QueryPluginBase::addSignature public function Add a signature to the query, if such a thing is feasible. 1
QueryPluginBase::getAggregationInfo public function Get aggregation info for group by queries. 1
QueryPluginBase::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyInterface::getCacheContexts
QueryPluginBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyInterface::getCacheMaxAge 1
QueryPluginBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyInterface::getCacheTags 1
QueryPluginBase::getDateField public function Returns a Unix timestamp to database native timestamp expression. 1
QueryPluginBase::getDateFormat public function Creates cross-database date formatting. 1
QueryPluginBase::getEntityTableInfo public function Returns an array of all tables from the query that map to an entity type.
QueryPluginBase::getLimit public function Returns the limit of the query.
QueryPluginBase::getTimezoneOffset public function Get the timezone offset in seconds.
QueryPluginBase::loadEntities public function Loads all entities contained in the passed-in $results. . If the entity belongs to the base table, then it gets stored in $result->_entity. Otherwise, it gets stored in $result->_relationship_entities[$relationship_id]; 1
QueryPluginBase::query public function Generate a query and a countquery from all of the information supplied to the object. Overrides PluginBase::query 1
QueryPluginBase::setFieldTimezoneOffset public function Applies a timezone offset to the given field. 2
QueryPluginBase::setGroupOperator public function Control how all WHERE and HAVING groups are put together.
QueryPluginBase::setLimit public function Set a LIMIT on the query, specifying a maximum number of results.
QueryPluginBase::setOffset public function Set an OFFSET on the query, specifying a number of results to skip
QueryPluginBase::setupTimezone public function Set the database to the current user timezone. 1
QueryPluginBase::setWhereGroup public function Create a new grouping for the WHERE or HAVING clause.
QueryPluginBase::submitOptionsForm public function Handle any special handling on the validate form. Overrides PluginBase::submitOptionsForm 1
QueryPluginBase::summaryTitle public function Returns the summary of the settings in the display. Overrides PluginBase::summaryTitle
QueryPluginBase::validateOptionsForm public function Validate the options form. Overrides PluginBase::validateOptionsForm
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
TrustedCallbackInterface::THROW_EXCEPTION constant Untrusted callbacks throw exceptions.
TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION constant Untrusted callbacks trigger silenced E_USER_DEPRECATION errors.
TrustedCallbackInterface::TRIGGER_WARNING constant Untrusted callbacks trigger E_USER_WARNING errors.