/**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     if (($event = $this->configuration['entity']) instanceof EntityInterface) {
         $group = $query->andConditionGroup()->condition('event__target_type', $event->getEntityTypeId(), '=')->condition('event__target_id', $event->id(), '=');
         $query->condition($group);
         $query->condition('source', NULL, 'IS NULL');
     }
     return $query;
 }
 /**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     // Adding the 'comment_access' tag is sadly insufficient for comments:
     // core requires us to also know about the concept of 'published' and
     // 'unpublished'.
     if (!$this->currentUser->hasPermission('administer comments')) {
         $query->condition('status', CommentInterface::PUBLISHED);
     }
     return $query;
 }
Exemple #3
0
 /**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     // Adding the 'node_access' tag is sadly insufficient for nodes: core
     // requires us to also know about the concept of 'published' and
     // 'unpublished'. We need to do that as long as there are no access control
     // modules in use on the site. As long as one access control module is there,
     // it is supposed to handle this check.
     if (!$this->currentUser->hasPermission('bypass node access') && !count($this->moduleHandler->getImplementations('node_grants'))) {
         $query->condition('status', NODE_PUBLISHED);
     }
     return $query;
 }
 /**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     if (($registration_group = $this->configuration['entity']) instanceof GroupInterface) {
         /** @var GroupInterface $registration_group */
         if (($event = $registration_group->getEvent()) instanceof EntityInterface) {
             $group = $query->andConditionGroup()->condition('event__target_type', $event->getEntityTypeId(), '=')->condition('event__target_id', $event->id(), '=');
             $query->condition($group);
         }
         $id_key = $registration_group->getEntityType()->getKey('id');
         $query->condition($id_key, [$registration_group->id()], 'NOT IN');
     }
     $query->condition('source', NULL, 'IS NULL');
     return $query;
 }
 /**
  * {@inheritdoc}
  */
 public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0)
 {
     if ($match || $limit) {
         return parent::getReferenceableEntities($match, $match_operator, $limit);
     }
     $options = array();
     $bundles = $this->entityManager->getBundleInfo('taxonomy_term');
     $handler_settings = $this->configuration['handler_settings'];
     $bundle_names = !empty($handler_settings['target_bundles']) ? $handler_settings['target_bundles'] : array_keys($bundles);
     foreach ($bundle_names as $bundle) {
         if ($vocabulary = Vocabulary::load($bundle)) {
             if ($terms = $this->entityManager->getStorage('taxonomy_term')->loadTree($vocabulary->id(), 0, NULL, TRUE)) {
                 foreach ($terms as $term) {
                     $options[$vocabulary->id()][$term->id()] = str_repeat('-', $term->depth) . String::checkPlain($term->getName());
                 }
             }
         }
     }
     return $options;
 }
Exemple #6
0
 /**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     // The user entity doesn't have a label column.
     if (isset($match)) {
         $query->condition('name', $match, $match_operator);
     }
     // Filter by role.
     $handler_settings = $this->configuration['handler_settings'];
     if (!empty($handler_settings['filter']['role'])) {
         $query->condition('roles', $handler_settings['filter']['role'], 'IN');
     }
     // Adding the permission check is sadly insufficient for users: core
     // requires us to also know about the concept of 'blocked' and 'active'.
     if (!$this->currentUser->hasPermission('administer users')) {
         $query->condition('status', 1);
     }
     return $query;
 }
 /**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     $this->removeDuplicateRegistrants($query);
     return $query;
 }
Exemple #8
0
 /**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     $query->condition('status', FILE_STATUS_PERMANENT);
     return $query;
 }