You are here

public function UserUid::query in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_group/src/Plugin/views/argument/UserUid.php \Drupal\social_group\Plugin\views\argument\UserUid::query()
  2. 8 modules/social_features/social_group/src/Plugin/views/argument/UserUid.php \Drupal\social_group\Plugin\views\argument\UserUid::query()
  3. 8.2 modules/social_features/social_group/src/Plugin/views/argument/UserUid.php \Drupal\social_group\Plugin\views\argument\UserUid::query()
  4. 8.3 modules/social_features/social_group/src/Plugin/views/argument/UserUid.php \Drupal\social_group\Plugin\views\argument\UserUid::query()
  5. 8.4 modules/social_features/social_group/src/Plugin/views/argument/UserUid.php \Drupal\social_group\Plugin\views\argument\UserUid::query()
  6. 8.5 modules/social_features/social_group/src/Plugin/views/argument/UserUid.php \Drupal\social_group\Plugin\views\argument\UserUid::query()
  7. 8.6 modules/social_features/social_group/src/Plugin/views/argument/UserUid.php \Drupal\social_group\Plugin\views\argument\UserUid::query()
  8. 8.7 modules/social_features/social_group/src/Plugin/views/argument/UserUid.php \Drupal\social_group\Plugin\views\argument\UserUid::query()
  9. 10.3.x modules/social_features/social_group/src/Plugin/views/argument/UserUid.php \Drupal\social_group\Plugin\views\argument\UserUid::query()
  10. 10.0.x modules/social_features/social_group/src/Plugin/views/argument/UserUid.php \Drupal\social_group\Plugin\views\argument\UserUid::query()
  11. 10.1.x modules/social_features/social_group/src/Plugin/views/argument/UserUid.php \Drupal\social_group\Plugin\views\argument\UserUid::query()
  12. 10.2.x modules/social_features/social_group/src/Plugin/views/argument/UserUid.php \Drupal\social_group\Plugin\views\argument\UserUid::query()

Set up the query for this argument.

The argument sent may be found at $this->argument.

Overrides ArgumentPluginBase::query

File

modules/social_features/social_group/src/Plugin/views/argument/UserUid.php, line 56

Class

UserUid
Argument handler to accept a user id.

Namespace

Drupal\social_group\Plugin\views\argument

Code

public function query($group_by = FALSE) {
  $this
    ->ensureMyTable();

  // Use the table definition to correctly add this user ID condition.
  if ($this->table != 'group_content_field_data') {
    $subselect2 = $this->database
      ->select('group_content_field_data', 'gc');
    $subselect2
      ->addField('gc', 'gid');
    $subselect2
      ->condition('gc.entity_id', $this->argument);
    $subselect2
      ->condition('gc.type', '%' . $this->database
      ->escapeLike('membership') . '%', 'LIKE');
    if ($this->usesOptions && isset($this->options['group'])) {
      $this->query
        ->addWhere($this->options['group'], 'groups_field_data.id', $subselect2, 'IN');
    }
    else {

      // Add with default options (AND).
      $this->query
        ->addWhere(0, 'groups_field_data.id', $subselect2, 'IN');
    }
  }
}