public function GroupContentBlock::query in Open Social 10.3.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_content_block/modules/social_group_content_block/src/Plugin/ContentBlock/GroupContentBlock.php \Drupal\social_group_content_block\Plugin\ContentBlock\GroupContentBlock::query()
- 8.8 modules/social_features/social_content_block/modules/social_group_content_block/src/Plugin/ContentBlock/GroupContentBlock.php \Drupal\social_group_content_block\Plugin\ContentBlock\GroupContentBlock::query()
- 10.0.x modules/social_features/social_content_block/modules/social_group_content_block/src/Plugin/ContentBlock/GroupContentBlock.php \Drupal\social_group_content_block\Plugin\ContentBlock\GroupContentBlock::query()
- 10.1.x modules/social_features/social_content_block/modules/social_group_content_block/src/Plugin/ContentBlock/GroupContentBlock.php \Drupal\social_group_content_block\Plugin\ContentBlock\GroupContentBlock::query()
- 10.2.x modules/social_features/social_content_block/modules/social_group_content_block/src/Plugin/ContentBlock/GroupContentBlock.php \Drupal\social_group_content_block\Plugin\ContentBlock\GroupContentBlock::query()
Create filtering query.
Parameters
\Drupal\Core\Database\Query\SelectInterface $query: The query.
array $fields: The fields.
Overrides ContentBlockPluginInterface::query
File
- modules/
social_features/ social_content_block/ modules/ social_group_content_block/ src/ Plugin/ ContentBlock/ GroupContentBlock.php, line 25
Class
- GroupContentBlock
- Provides a content block for groups.
Namespace
Drupal\social_group_content_block\Plugin\ContentBlockCode
public function query(SelectInterface $query, array $fields) {
foreach ($fields as $field_name => $entity_ids) {
switch ($field_name) {
case 'field_group_type':
$query
->condition('base_table.type', $entity_ids, 'IN');
break;
case 'field_group_content_tag':
$query
->innerJoin('group__social_tagging', 'st', 'st.entity_id = base_table.id');
$query
->condition('st.social_tagging_target_id', $entity_ids, 'IN');
break;
}
}
}