You are here

function _social_group_render_group_settings_hero in Open Social 10.0.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_group/social_group.module \_social_group_render_group_settings_hero()
  2. 10.1.x modules/social_features/social_group/social_group.module \_social_group_render_group_settings_hero()
  3. 10.2.x modules/social_features/social_group/social_group.module \_social_group_render_group_settings_hero()

Renders the group settings based on available fields for the hero.

Parameters

\Drupal\group\Entity\GroupInterface $group: the Group interface.

Return value

array the actual tooltip render array.

2 calls to _social_group_render_group_settings_hero()
social_group_preprocess_group in modules/social_features/social_group/social_group.module
Prepares variables for profile templates.
social_group_preprocess_group__hero in modules/social_features/social_group/social_group.module
Implements hook_preprocess_HOOK().

File

modules/social_features/social_group/social_group.module, line 386
The Social group module.

Code

function _social_group_render_group_settings_hero(GroupInterface $group) {
  $description = '';

  // Optional after 10.0.x we can render the group visibility.
  if ($group_visibility_option = _social_group_get_group_visibility($group)) {

    // Wrap our chosen description in a container.
    $description .= '<span class="title">' . t('Group visibility') . '</span>';
    $description .= '<div class="group-visibility-details container-background">';
    foreach ($group_visibility_option as $key => $group_visibility_string) {
      $description .= $group_visibility_string;
    }
    $description .= '</div>';
  }

  // Optional after 9.x we can render the allowed content visibility.
  if ($allowed_visibility_option = _social_group_get_allowed_visibility($group)) {

    // Wrap our chosen description in a container.
    $description .= '<span class="title">' . t('Group content visibility') . '</span>';
    $description .= '<div class="group-visibility-details container-background">';
    foreach ($allowed_visibility_option as $key => $allowed_visibility_string) {
      $description .= $allowed_visibility_string;
    }
    $description .= '</div>';
  }

  // Optional after 9.x we can render the join methods.
  if ($join_methods_option = _social_group_get_join_methods($group)) {

    // Wrap our chosen description in a container.
    $description .= '<span class="title">' . t('Join method') . '</span>';
    $description .= '<div class="group-visibility-details container-background">';
    foreach ($join_methods_option as $key => $join_methods_string) {
      $description .= $join_methods_string;
    }
    $description .= '</div>';
  }
  return social_group_render_tooltip('group_hero', t('Access permissions'), $description);
}