You are here

public function PostGroupStream::query in Open Social 8.8

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

Query for the activity stream on the group pages.

Overrides FilterPluginBase::query

File

modules/social_features/social_post/src/Plugin/views/filter/PostGroupStream.php, line 41

Class

PostGroupStream
Filters post on a group stream.

Namespace

Drupal\social_post\Plugin\views\filter

Code

public function query() {

  // Get the group.
  $group = \Drupal::routeMatch()
    ->getParameter('group');

  // Visibility logic when visiting a post stream on group page:
  // - All the posts to the group by you and other users in the community.
  $this->query
    ->addTable('post__field_visibility');
  $this->query
    ->addTable('post__field_recipient_group');

  // Or posted to the group by the community.
  $recipient_condition = db_and();
  $recipient_condition
    ->condition('post__field_visibility.field_visibility_value', '0', '=');
  $recipient_condition
    ->condition('post__field_recipient_group.field_recipient_group_target_id', $group
    ->id(), '=');
  $this->query
    ->addWhere('visibility', $recipient_condition);
}