Same name and namespace in other branches
- 8.9.x core/modules/node/src/Plugin/views/filter/Access.php \Drupal\node\Plugin\views\filter\Access
- 9 core/modules/node/src/Plugin/views/filter/Access.php \Drupal\node\Plugin\views\filter\Access
Hierarchy
- class \Drupal\node\Plugin\views\filter\Access extends \Drupal\views\Plugin\views\filter\FilterPluginBase
Expanded class hierarchy of Access
4 string references to 'Access'
- node.views.schema.yml in core/
modules/ node/ config/ schema/ node.views.schema.yml - core/modules/node/config/schema/node.views.schema.yml
- NodeViewsData::getViewsData in core/
modules/ node/ src/ NodeViewsData.php - Returns views data for the entity type.
- views.argument_validator.schema.yml in core/
modules/ views/ config/ schema/ views.argument_validator.schema.yml - core/modules/views/config/schema/views.argument_validator.schema.yml
- views.data_types.schema.yml in core/
modules/ views/ config/ schema/ views.data_types.schema.yml - core/modules/views/config/schema/views.data_types.schema.yml
File
- core/
modules/ node/ src/ Plugin/ views/ filter/ Access.php, line 15
Namespace
Drupal\node\Plugin\views\filterView source
class Access extends FilterPluginBase {
public function adminSummary() {
}
protected function operatorForm(&$form, FormStateInterface $form_state) {
}
public function canExpose() {
return FALSE;
}
/**
* See _node_access_where_sql() for a non-views query based implementation.
*/
public function query() {
$account = $this->view
->getUser();
if (!$account
->hasPermission('bypass node access')) {
$table = $this
->ensureMyTable();
$grants = $this->query
->getConnection()
->condition('OR');
foreach (node_access_grants('view', $account) as $realm => $gids) {
foreach ($gids as $gid) {
$grants
->condition($this->query
->getConnection()
->condition('AND')
->condition($table . '.gid', $gid)
->condition($table . '.realm', $realm));
}
}
$this->query
->addWhere('AND', $grants);
$this->query
->addWhere('AND', $table . '.grant_view', 1, '>=');
}
}
/**
* {@inheritdoc}
*/
public function getCacheContexts() {
$contexts = parent::getCacheContexts();
$contexts[] = 'user.node_grants:view';
return $contexts;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Access:: |
public | function | ||
Access:: |
public | function | ||
Access:: |
public | function | ||
Access:: |
protected | function | ||
Access:: |
public | function | See _node_access_where_sql() for a non-views query based implementation. |