You are here

protected function GroupContentToEntityBase::getGroupContentTypeIds in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/views/relationship/GroupContentToEntityBase.php \Drupal\group\Plugin\views\relationship\GroupContentToEntityBase::getGroupContentTypeIds()

Returns the group content types this relationship should filter on.

This checks if any plugins were selected on the option form and, in that case, loads only those group content types available to the selected plugins. Otherwise, all possible group content types for the relationship's entity type are loaded.

This needs to happen live to cover the use case where a group content plugin is installed on a group type after this relationship has been configured on a view without any plugins selected.

@todo Could be cached even more, I guess.

Return value

string[] The group content type IDs to filter on.

1 call to GroupContentToEntityBase::getGroupContentTypeIds()
GroupContentToEntityBase::query in src/Plugin/views/relationship/GroupContentToEntityBase.php
Add anything to the query that we might need to.

File

src/Plugin/views/relationship/GroupContentToEntityBase.php, line 185

Class

GroupContentToEntityBase
A relationship handler base for group content entity references.

Namespace

Drupal\group\Plugin\views\relationship

Code

protected function getGroupContentTypeIds() {
  $plugin_ids = array_filter($this->options['group_content_plugins']);
  $group_content_type_ids = [];
  foreach ($plugin_ids as $plugin_id) {
    $group_content_type_ids = array_merge($group_content_type_ids, $this->pluginManager
      ->getGroupContentTypeIds($plugin_id));
  }
  return $plugin_ids ? $group_content_type_ids : array_keys(GroupContentType::loadByEntityTypeId($this
    ->getTargetEntityType()));
}