You are here

public function RecentGroupContentBlock::defaultConfiguration in Organic groups 8

Overrides BlockPluginTrait::defaultConfiguration

File

src/Plugin/Block/RecentGroupContentBlock.php, line 101

Class

RecentGroupContentBlock
Provides a block that shows recent group content for the current group.

Namespace

Drupal\og\Plugin\Block

Code

public function defaultConfiguration() {

  // Default to the first entity type in the list.
  $bundles = $this->groupTypeManager
    ->getAllGroupContentBundleIds();
  reset($bundles);
  $entity_type_default = key($bundles);

  // Enable all bundles by default.
  $bundle_defaults = [];
  foreach ($bundles as $entity_type_id => $bundle_ids) {
    foreach ($bundle_ids as $bundle_id) {
      $bundle_defaults[$entity_type_id][$bundle_id] = $bundle_id;
    }
  }
  return [
    'entity_type' => $entity_type_default,
    'bundles' => $bundle_defaults,
    'count' => 5,
  ];
}