Social groups requires the socialblue theme and breaks some functionalities with a cloned theme

Created on 17 July 2019, over 5 years ago
Updated 4 September 2024, 3 months ago

I have cloned the Socialblue theme in order to extend it, as suggested in the theme's readme.md file:

The safest and fastest way to get started is to duplicate this theme and rename it to your custom theme name.

After enabling my new cloned theme, I uninstalled the socialblue theme. I expected that this would be fine because now my cloned theme depends on the socialbase theme. However; when I visit a group's members management page (E.g.: /group/5/membership), I get the following error:

TypeError: Argument 1 passed to Drupal\block\BlockViewBuilder::view() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /app/html/profiles/contrib/social/modules/social_features/social_group/social_group.module on line 1102 in Drupal\block\BlockViewBuilder->view() (line 30 of /app/html/core/modules/block/src/BlockViewBuilder.php) 

After inspecting the content of social_group.module, I see that a block with ID socialblue_local_actions is being loaded near line 1102:

$entity = \Drupal::entityTypeManager()->getStorage('block')
      ->load('socialblue_local_actions');

Upon further inspection, I see that the block called "Primary admin actions" has the ID socialblue_local_actions on the Socialblue theme; however, the same block has the ID mythemename_local_actions on my cloned theme.

I have fixed the problem by re-enabling the Socialblue theme; but, I think it shouldn't be necessary to have a theme enabled if it isn't going to be used.

A possibly better solution would be to move the function

/**
 * Implements hook_preprocess_HOOK().
 */
function social_group_preprocess_views_view(&$variables) {
  /** @var \Drupal\views\ViewExecutable $view */
  $view = &$variables['view'];

  if ($view->id() === 'group_manage_members') {
    $entity = \Drupal::entityTypeManager()->getStorage('block')
      ->load('socialblue_local_actions');

    $variables['header']['actions'] = \Drupal::entityTypeManager()
      ->getViewBuilder('block')
      ->view($entity);
  }
}

...into the socialblue.theme file and document the necessary string replacements for new cloned themes.

I'd be happy to try this fix and share a patch, if you think this is a good idea.

Thank you for the great work on this distribution.

πŸ› Bug report
Status

Active

Version

11.9

Component

Groups

Created by

πŸ‡ΊπŸ‡ΈUnited States jcmartinez Raleigh, NC, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024