Commit 194f7bfa authored by Finn's avatar Finn
Browse files

Update addPage to work with Group 3.x and suppress errors from #3325129

parent 65644a22
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -41,11 +41,13 @@ class GroupMediaController extends GroupRelationshipController {
    // Overwrite the label and description for all displayed bundles.
    $media_type_storage = $this->entityTypeManager->getStorage('media_type');
    $group_type = $group->getGroupType();
    foreach ($this->addPageBundles($group, $create_mode) as $plugin_id => $bundle_name) {
    foreach ($this->addPageBundles($group, $create_mode, $base_plugin_id) as $plugin_id => $bundle) {
      $bundle_name = $bundle->getOriginalId();
      if (!empty($build['#bundles'][$bundle_name])) {
        $plugin_id = $bundle->get('content_plugin');
        $plugin = $group_type->getPlugin($plugin_id);
        $bundle_label = $media_type_storage->load($plugin->getEntityBundle())->label();

        $bundle_type = $plugin->getRelationType()->getEntityBundle();
        $bundle_label = $media_type_storage->load($bundle_type)->label();
        $t_args = ['%media_type' => $bundle_label];
        $description = $create_mode
          ? $this->t('Create a media of type %media_type in the group.', $t_args)