class TopicContentBlock in Open Social 10.1.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_content_block/src/Plugin/ContentBlock/TopicContentBlock.php \Drupal\social_content_block\Plugin\ContentBlock\TopicContentBlock
- 8.8 modules/social_features/social_content_block/src/Plugin/ContentBlock/TopicContentBlock.php \Drupal\social_content_block\Plugin\ContentBlock\TopicContentBlock
- 10.3.x modules/social_features/social_content_block/src/Plugin/ContentBlock/TopicContentBlock.php \Drupal\social_content_block\Plugin\ContentBlock\TopicContentBlock
- 10.0.x modules/social_features/social_content_block/src/Plugin/ContentBlock/TopicContentBlock.php \Drupal\social_content_block\Plugin\ContentBlock\TopicContentBlock
- 10.2.x modules/social_features/social_content_block/src/Plugin/ContentBlock/TopicContentBlock.php \Drupal\social_content_block\Plugin\ContentBlock\TopicContentBlock
Provides a content block for topics.
Plugin annotation
@ContentBlock(
id = "topic_content_block",
entityTypeId = "node",
bundle = "topic",
fields = {
"field_topic_type",
"field_content_tags",
"field_group",
},
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\social_content_block\ContentBlockBase implements ContentBlockPluginInterface
- class \Drupal\social_content_block\Plugin\ContentBlock\TopicContentBlock
- class \Drupal\social_content_block\ContentBlockBase implements ContentBlockPluginInterface
Expanded class hierarchy of TopicContentBlock
File
- modules/
social_features/ social_content_block/ src/ Plugin/ ContentBlock/ TopicContentBlock.php, line 22
Namespace
Drupal\social_content_block\Plugin\ContentBlockView source
class TopicContentBlock extends ContentBlockBase {
/**
* {@inheritdoc}
*/
public function query(SelectInterface $query, array $fields) {
foreach ($fields as $field_name => $entity_ids) {
switch ($field_name) {
// Add topic type tags.
case 'field_topic_type':
$query
->innerJoin('node__field_topic_type', 'tt', 'tt.entity_id = base_table.nid');
$query
->condition('tt.field_topic_type_target_id', $entity_ids, 'IN');
break;
// Add group tags.
case 'field_group':
$query
->innerJoin('group_content_field_data', 'gd', 'gd.entity_id = base_table.nid');
$query
->condition('gd.type', '%' . $query
->escapeLike('-group_node-topic'), 'LIKE');
$query
->condition('gd.gid', $entity_ids, 'IN');
break;
case 'field_content_tags':
$query
->innerJoin('node__social_tagging', 'st', 'st.entity_id = base_table.nid');
$query
->condition('st.social_tagging_target_id', $entity_ids, 'IN');
break;
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentBlockBase:: |
public | function |
The sort options that are supported for this content block type. Overrides ContentBlockPluginInterface:: |
1 |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
2 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | 98 |
TopicContentBlock:: |
public | function |
Create filtering query. Overrides ContentBlockPluginInterface:: |