public function ActivityProfileArgument::query in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/activity_viewer/src/Plugin/views/argument/ActivityProfileArgument.php \Drupal\activity_viewer\Plugin\views\argument\ActivityProfileArgument::query()
- 8.2 modules/custom/activity_viewer/src/Plugin/views/argument/ActivityProfileArgument.php \Drupal\activity_viewer\Plugin\views\argument\ActivityProfileArgument::query()
- 8.3 modules/custom/activity_viewer/src/Plugin/views/argument/ActivityProfileArgument.php \Drupal\activity_viewer\Plugin\views\argument\ActivityProfileArgument::query()
- 8.4 modules/custom/activity_viewer/src/Plugin/views/argument/ActivityProfileArgument.php \Drupal\activity_viewer\Plugin\views\argument\ActivityProfileArgument::query()
- 8.5 modules/custom/activity_viewer/src/Plugin/views/argument/ActivityProfileArgument.php \Drupal\activity_viewer\Plugin\views\argument\ActivityProfileArgument::query()
- 8.6 modules/custom/activity_viewer/src/Plugin/views/argument/ActivityProfileArgument.php \Drupal\activity_viewer\Plugin\views\argument\ActivityProfileArgument::query()
- 8.7 modules/custom/activity_viewer/src/Plugin/views/argument/ActivityProfileArgument.php \Drupal\activity_viewer\Plugin\views\argument\ActivityProfileArgument::query()
- 8.8 modules/custom/activity_viewer/src/Plugin/views/argument/ActivityProfileArgument.php \Drupal\activity_viewer\Plugin\views\argument\ActivityProfileArgument::query()
- 10.3.x modules/custom/activity_viewer/src/Plugin/views/argument/ActivityProfileArgument.php \Drupal\activity_viewer\Plugin\views\argument\ActivityProfileArgument::query()
- 10.0.x modules/custom/activity_viewer/src/Plugin/views/argument/ActivityProfileArgument.php \Drupal\activity_viewer\Plugin\views\argument\ActivityProfileArgument::query()
- 10.1.x modules/custom/activity_viewer/src/Plugin/views/argument/ActivityProfileArgument.php \Drupal\activity_viewer\Plugin\views\argument\ActivityProfileArgument::query()
- 10.2.x modules/custom/activity_viewer/src/Plugin/views/argument/ActivityProfileArgument.php \Drupal\activity_viewer\Plugin\views\argument\ActivityProfileArgument::query()
Set up the query for this argument.
The argument sent may be found at $this->argument.
Overrides ArgumentPluginBase::query
File
- modules/
custom/ activity_viewer/ src/ Plugin/ views/ argument/ ActivityProfileArgument.php, line 21
Class
- ActivityProfileArgument
- Default implementation of the base argument plugin.
Namespace
Drupal\activity_viewer\Plugin\views\argumentCode
public function query($group_by = FALSE) {
$this
->ensureMyTable();
// \Drupal\views\Plugin\views\query\QueryPluginBase.
$this->query
->addTable('activity__field_activity_recipient_user');
$this->query
->addTable('activity__field_activity_entity');
$this->query
->addTable('activity__field_activity_destinations');
$or_condition = db_or();
// User is a recipient.
$or_condition
->condition('activity__field_activity_recipient_user.field_activity_recipient_user_target_id', $this->argument, '=');
// Or posted by the user, but not on someone else his profile..
// TODO Because of this set-up we have to use distinct. Not perfect.
$by_user = db_and();
$by_user
->condition('activity_field_data.user_id', $this->argument, '=');
$by_user
->condition('activity__field_activity_recipient_user.field_activity_recipient_user_target_id', NULL, 'IS NULL');
// TODO Add condition for posts in a group as well (do not show them).
$or_condition
->condition($by_user);
$this->query
->addWhere('activity_profile_argument', $or_condition);
}