You are here

class GroupContentBlock in Open Social 10.3.x

Same name and namespace in other branches
  1. 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
  2. 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
  3. 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
  4. 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
  5. 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

Provides a content block for groups.

Plugin annotation


@ContentBlock(
  id = "group_content_block",
  entityTypeId = "group",
  fields = {
    "field_group_type",
    "field_group_content_tag",
  },
)

Hierarchy

Expanded class hierarchy of GroupContentBlock

File

modules/social_features/social_content_block/modules/social_group_content_block/src/Plugin/ContentBlock/GroupContentBlock.php, line 20

Namespace

Drupal\social_group_content_block\Plugin\ContentBlock
View source
class GroupContentBlock extends ContentBlockBase {

  /**
   * {@inheritdoc}
   */
  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;
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContentBlockBase::supportedSortOptions public function The sort options that are supported for this content block type. Overrides ContentBlockPluginInterface::supportedSortOptions 1
GroupContentBlock::query public function Create filtering query. Overrides ContentBlockPluginInterface::query
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 2
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. 98