Commit 3dfac836 authored by Finn Lewis's avatar Finn Lewis Committed by Nikolay Lobachev
Browse files

Issue #3325129 by Finn Lewis, LOBsTerr: Too few arguments for...

Issue #3325129 by Finn Lewis, LOBsTerr: Too few arguments for GroupMediaController->addPageBundles() when enabling multiple media types in a group
parent 65644a22
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -41,18 +41,18 @@ 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) {
      if (!empty($build['#bundles'][$bundle_name])) {
        $plugin = $group_type->getPlugin($plugin_id);
        $bundle_label = $media_type_storage->load($plugin->getEntityBundle())->label();

        $t_args = ['%media_type' => $bundle_label];
    foreach ($this->addPageBundles($group, $create_mode, $base_plugin_id) as $bundle_id => $bundle) {
      if (!empty($build['#bundles'][$bundle_id])) {
        $plugin = $group_type->getPlugin($bundle->getPluginId());
        $media_type = $plugin->getRelationType()->getEntityBundle();
        $media_type_label = $media_type_storage->load($media_type)->label();
        $t_args = ['%media_type' => $media_type_label];
        $description = $create_mode
          ? $this->t('Create a media of type %media_type in the group.', $t_args)
          : $this->t('Add an existing media of type %media_type to the group.', $t_args);

        $build['#bundles'][$bundle_name]['label'] = $bundle_label;
        $build['#bundles'][$bundle_name]['description'] = $description;
        $build['#bundles'][$bundle_id]['label'] = $media_type_label;
        $build['#bundles'][$bundle_id]['description'] = $description;
      }
    }