Drupal 8  8.0.2
QueryPluginBase Class Reference
Inheritance diagram for QueryPluginBase:

Public Member Functions

 query ($get_count=FALSE)
 
 alter (ViewExecutable $view)
 
 build (ViewExecutable $view)
 
 execute (ViewExecutable $view)
 
 addSignature (ViewExecutable $view)
 
 getAggregationInfo ()
 
 validateOptionsForm (&$form, FormStateInterface $form_state)
 
 submitOptionsForm (&$form, FormStateInterface $form_state)
 
 summaryTitle ()
 
 calculateDependencies ()
 
 setLimit ($limit)
 
 setOffset ($offset)
 
 getLimit ()
 
 setWhereGroup ($type= 'AND', $group=NULL, $where= 'where')
 
 setGroupOperator ($type= 'AND')
 
 loadEntities (&$results)
 
 getDateField ($field)
 
 setupTimezone ()
 
 getDateFormat ($field, $format, $string_date=FALSE)
 
 getEntityTableInfo ()
 
 getCacheMaxAge ()
 
 getCacheContexts ()
 
 getCacheTags ()
 
- Public Member Functions inherited from PluginBase
 __construct (array $configuration, $plugin_id, $plugin_definition)
 
 init (ViewExecutable $view, DisplayPluginBase $display, array &$options=NULL)
 
 filterByDefinedOptions (array &$storage)
 
 unpackOptions (&$storage, $options, $definition=NULL, $all=TRUE, $check=TRUE)
 
 destroy ()
 
 buildOptionsForm (&$form, FormStateInterface $form_state)
 
 validateOptionsForm (&$form, FormStateInterface $form_state)
 
 submitOptionsForm (&$form, FormStateInterface $form_state)
 
 query ()
 
 themeFunctions ()
 
 validate ()
 
 summaryTitle ()
 
 pluginTitle ()
 
 usesOptions ()
 
 globalTokenReplace ($string= '', array $options=array())
 
 getAvailableGlobalTokens ($prepared=FALSE, array $types=array())
 
 globalTokenForm (&$form, FormStateInterface $form_state)
 
 calculateDependencies ()
 
 getProvider ()
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 
- Public Member Functions inherited from DerivativeInspectionInterface
 getBaseId ()
 
 getDerivativeId ()
 

Data Fields

 $pager = NULL
 
- Data Fields inherited from PluginBase
const INCLUDE_NEGOTIATED = 16
 
const INCLUDE_ENTITY = 32
 
const VIEWS_QUERY_LANGUAGE_SITE_DEFAULT = '***LANGUAGE_site_default***'
 
 $options = array()
 
 $view = NULL
 
 $displayHandler
 
 $definition
 

Protected Attributes

 $limit
 
- Protected Attributes inherited from PluginBase
 $usesOptions = FALSE
 
 $renderer
 

Additional Inherited Members

- Static Public Member Functions inherited from PluginBase
static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 
static preRenderAddFieldsetMarkup (array $form)
 
static preRenderFlattenData ($form)
 
static queryLanguageSubstitutions ()
 
- Protected Member Functions inherited from PluginBase
 defineOptions ()
 
 setOptionDefaults (array &$storage, array $options)
 
 doFilterByDefinedOptions (array &$storage, array $options)
 
 viewsTokenReplace ($text, $tokens)
 
 listLanguages ($flags=LanguageInterface::STATE_ALL, array $current_values=NULL)
 
 getRenderer ()
 

Detailed Description

Base plugin class for Views queries.

Member Function Documentation

addSignature ( ViewExecutable  $view)

Add a signature to the query, if such a thing is feasible.

This signature is something that can be used when perusing query logs to discern where particular queries might be coming from.

Parameters
view$viewThe view which is executed.
alter ( ViewExecutable  $view)

Let modules modify the query just prior to finalizing it.

Parameters
view$viewThe view which is executed.
build ( ViewExecutable  $view)

Builds the necessary info to execute the query.

Parameters
view$viewThe view which is executed.
calculateDependencies ( )

{Calculates dependencies for the configured plugin.Dependencies are saved in the plugin's configuration entity and are used to determine configuration synchronization order. For example, if the plugin integrates with specific user roles, this method should return an array of dependencies listing the specified roles.

Returns
array An array of dependencies grouped by type (config, content, module, theme). For example:
array(
'config' => array('user.role.anonymous', 'user.role.authenticated'),
'content' => array('node:article:f0a189e6-55fb-47fb-8005-5bef81c44d6d'),
'module' => array('node', 'user'),
'theme' => array('seven'),
);
See Also
::getConfigDependencyName()
}

Implements DependentPluginInterface.

References QueryPluginBase\getEntityTableInfo().

Here is the call graph for this function:

execute ( ViewExecutable  $view)

Executes the query and fills the associated view object with according values.

Values to set: $view->result, $view->total_rows, $view->execute_time, $view->pager['current_page'].

$view->result should contain an array of objects. The array must use a numeric index starting at 0.

Parameters
view$viewThe view which is executed.
getAggregationInfo ( )

Get aggregation info for group by queries.

If NULL, aggregation is not allowed.

getCacheContexts ( )

{The cache contexts associated with this object.These identify a specific variation/representation of the object.Cache contexts are tokens: placeholders that are converted to cache keys by the service. The replacement value depends on the request context (the current URL, language, and so on). They're converted before storing an object in cache.

Returns
string[] An array of cache context tokens, used to generate a cache ID.
See Also
::convertTokensToKeys()
}

Implements CacheableDependencyInterface.

References Drupal\entityManager(), and Views\viewsData().

Here is the call graph for this function:

getCacheMaxAge ( )

{The maximum age for which this object may be cached.

Returns
int The maximum time in seconds that this object may be cached.
}

Implements CacheableDependencyInterface.

References Cache\PERMANENT.

getCacheTags ( )

{The cache tags associated with this object.When this object is modified, these cache tags will be invalidated.

Returns
string[] A set of cache tags.
}

Implements CacheableDependencyInterface.

getDateField (   $field)

Returns a Unix timestamp to database native timestamp expression.

Parameters
string$fieldThe query field that will be used in the expression.
Returns
string An expression representing a timestamp with time zone.
getDateFormat (   $field,
  $format,
  $string_date = FALSE 
)

Creates cross-database date formatting.

Parameters
string$fieldAn appropriate query expression pointing to the date field.
string$formatA format string for the result, like 'Y-m-d H:i:s'.
boolean$string_dateFor certain databases, date format functions vary depending on string or numeric storage.
Returns
string A string representing the field formatted as a date in the format specified by $format.
getEntityTableInfo ( )

Returns an array of all tables from the query that map to an entity type.

Includes the base table and all relationships, if eligible.

Available keys for each table:

  • base: The actual base table (i.e. "user" for an author relationship).
  • relationship_id: The id of the relationship, or "none".
  • alias: The alias used for the relationship.
  • entity_type: The entity type matching the base table.
  • revision: A boolean that specifies whether the table is a base table or a revision table of the entity type.
Returns
array An array of table information, keyed by table alias.

References Drupal\entityManager(), and Views\viewsData().

Referenced by QueryPluginBase\calculateDependencies(), and Sql\query().

Here is the call graph for this function:

Here is the caller graph for this function:

getLimit ( )

Returns the limit of the query.

loadEntities ( $results)

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];

Query plugins that don't support entities can leave the method empty.

query (   $get_count = FALSE)

Generate a query and a countquery from all of the information supplied to the object.

Parameters
$get_countProvide a countquery if this is true, otherwise provide a normal query.
setGroupOperator (   $type = 'AND')

Control how all WHERE and HAVING groups are put together.

Parameters
$typeEither 'AND' or 'OR'
setLimit (   $limit)

Set a LIMIT on the query, specifying a maximum number of results.

setOffset (   $offset)

Set an OFFSET on the query, specifying a number of results to skip

setupTimezone ( )

Set the database to the current user timezone,

Returns
string The current timezone as returned by drupal_get_user_timezone().
setWhereGroup (   $type = 'AND',
  $group = NULL,
  $where = 'where' 
)

Create a new grouping for the WHERE or HAVING clause.

Parameters
$typeEither 'AND' or 'OR'. All items within this group will be added to the WHERE clause with this logical operator.
$groupAn ID to use for this group. If unspecified, an ID will be generated.
$where'where' or 'having'.
Returns
$group The group ID generated.

Referenced by Sql\addHavingExpression(), Sql\addWhere(), and Sql\addWhereExpression().

Here is the caller graph for this function:

submitOptionsForm ( $form,
FormStateInterface  $form_state 
)

Handle any special handling on the validate form.

Implements ViewsPluginInterface.

summaryTitle ( )

Returns the summary of the settings in the display.

Implements ViewsPluginInterface.

References t().

Here is the call graph for this function:

validateOptionsForm ( $form,
FormStateInterface  $form_state 
)

Validate the options form.

Implements ViewsPluginInterface.


The documentation for this class was generated from the following file: