| 1 |
<?php if (!defined('ABSPATH')) exit; // Exit if accessed directly ?> |
| 2 |
<?php |
| 3 |
/** |
| 4 |
* @var $primaryItems array |
| 5 |
* @var $settingsItems array |
| 6 |
* @var $spaceGroups array |
| 7 |
* @var $topInlineLinks array |
| 8 |
* @var $bottomLinkGroups array |
| 9 |
* @var $is_admin bool |
| 10 |
* @var $has_color_scheme bool |
| 11 |
* @var $context string |
| 12 |
*/ |
| 13 |
|
| 14 |
use FluentCommunity\App\Services\Helper; |
| 15 |
|
| 16 |
$fluentCommunityShowFeedLink = \FluentCommunity\App\Functions\Utility::isCustomizationEnabled('feed_link_on_sidebar'); |
| 17 |
$fluentCommunityCollapsedGroups = Helper::getCollapsedSidebarGroups(array_merge((array) $spaceGroups, (array) $bottomLinkGroups)); |
| 18 |
|
| 19 |
?> |
| 20 |
|
| 21 |
<div id="fcom_sidebar_wrap" class="fcom_sidebar_wrap"> |
| 22 |
<?php if (apply_filters('fluent_community/will_render_default_sidebar_items', true)) : ?> |
| 23 |
<nav aria-label="<?php echo esc_attr__('Main Sidebar Home menu', 'fluent-community'); ?>"> |
| 24 |
<ul class="fcom_sm_only fcom_general_menu fcom_home_link"> |
| 25 |
<?php Helper::renderMenuItems($primaryItems, 'fcom_menu_link', '<span class="fcom_no_avatar"></span>', true); ?> |
| 26 |
</ul> |
| 27 |
</nav> |
| 28 |
<?php if($fluentCommunityShowFeedLink || $topInlineLinks): ?> |
| 29 |
<nav aria-label="<?php echo esc_attr__('Main Sidebar Mobile Menu', 'fluent-community'); ?>"> |
| 30 |
<ul class="fcom_general_menu"> |
| 31 |
<?php if ($fluentCommunityShowFeedLink): ?> |
| 32 |
<li class="fcom_menu_item_all_feeds fcom_desktop_only"> |
| 33 |
<a class="fcom_menu_link fcom_dashboard route_url" |
| 34 |
href="<?php echo esc_url(Helper::baseUrl('/')); ?>"> |
| 35 |
<div class="community_avatar"> |
| 36 |
<span class="fcom_shape"> |
| 37 |
<i class="el-icon"> |
| 38 |
<?php if (!empty($primaryItems['all_feeds'])): ?> |
| 39 |
<?php Helper::printLinkIcon($primaryItems['all_feeds']); // prints directly with internal escaping ?> |
| 40 |
<?php else: ?> |
| 41 |
<svg width="20" height="18" viewBox="0 0 20 18" fill="none"> |
| 42 |
<path fill-rule="evenodd" d="M10 13.166H10.0075H10Z" fill="currentColor"/> |
| 43 |
<path d="M10 13.166H10.0075" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> |
| 44 |
<path d="M16.6666 6.08301V10.2497C16.6666 13.3924 16.6666 14.9637 15.6903 15.94C14.714 16.9163 13.1426 16.9163 9.99992 16.9163C6.85722 16.9163 5.28587 16.9163 4.30956 15.94C3.33325 14.9637 3.33325 13.3924 3.33325 10.2497V6.08301" stroke="currentColor" stroke-width="1.5"/> |
| 45 |
<path d="M18.3333 7.74967L14.714 4.27925C12.4918 2.14842 11.3807 1.08301 9.99996 1.08301C8.61925 1.08301 7.50814 2.14842 5.28592 4.27924L1.66663 7.74967" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/> |
| 46 |
</svg> |
| 47 |
<?php endif; ?> |
| 48 |
</i> |
| 49 |
</span> |
| 50 |
</div> |
| 51 |
<span class="community_name"> |
| 52 |
<?php if (!empty($primaryItems['all_feeds']['title'])): ?> |
| 53 |
<?php echo esc_html($primaryItems['all_feeds']['title']); ?> |
| 54 |
<?php else: ?> |
| 55 |
<?php esc_html_e('Feed', 'fluent-community'); ?> |
| 56 |
<?php endif; ?> |
| 57 |
</span> |
| 58 |
</a> |
| 59 |
</li> |
| 60 |
<?php endif; ?> |
| 61 |
<?php Helper::renderMenuItems($topInlineLinks, 'fcom_menu_link fcom_custom_link', '<span class="fcom_no_avatar"></span>', true); ?> |
| 62 |
</ul> |
| 63 |
</nav> |
| 64 |
<?php endif; ?> |
| 65 |
|
| 66 |
<div class="fcom_sidebar_contents"> |
| 67 |
<?php foreach ($spaceGroups as $fluentCommunitySpaceGroup): ?> |
| 68 |
<?php if($fluentCommunitySpaceGroup['children']): ?> |
| 69 |
<?php |
| 70 |
$fluentCommunityGroupCollapsedClass = in_array(sanitize_key((string) $fluentCommunitySpaceGroup['id']), $fluentCommunityCollapsedGroups, true) |
| 71 |
? ' fcom_group_collapsed' |
| 72 |
: ''; |
| 73 |
?> |
| 74 |
<div class="<?php echo esc_attr('fcom_communities_menu' . $fluentCommunityGroupCollapsedClass); ?>"> |
| 75 |
<div class="fcom_space_group_header fcom_group_title"> |
| 76 |
<h4 data-group_id="<?php echo (int)$fluentCommunitySpaceGroup['id']; ?>" data-fcom-tip="<?php echo esc_attr($fluentCommunitySpaceGroup['title']); ?>" class="space_section_title" tabindex="0" role="button" aria-label="<?php echo esc_attr($fluentCommunitySpaceGroup['title']); ?>" aria-expanded="<?php echo $fluentCommunityGroupCollapsedClass ? 'false' : 'true'; ?>"> |
| 77 |
<span><?php echo esc_html($fluentCommunitySpaceGroup['title']); ?></span> |
| 78 |
<i class="el-icon fcom_space_down"> |
| 79 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path></svg> |
| 80 |
</i> |
| 81 |
</h4> |
| 82 |
<?php if ($is_admin): ?> |
| 83 |
<div class="fcom_space_create"> |
| 84 |
<a class="fcom_space_create_link" data-parent_id="<?php echo (int)$fluentCommunitySpaceGroup['id']; ?>" href="<?php echo esc_url(Helper::baseUrl('discover/spaces/?create_space=yes&parent_id=' . $fluentCommunitySpaceGroup['id'])); ?>">+</a> |
| 85 |
</div> |
| 86 |
<?php endif; ?> |
| 87 |
</div> |
| 88 |
<nav aria-label="Group Menu for <?php echo esc_html($fluentCommunitySpaceGroup['title']); ?>"> |
| 89 |
<ul> |
| 90 |
<?php foreach ($fluentCommunitySpaceGroup['children'] as $fluentCommunityLink): ?> |
| 91 |
<li class="space_menu_item"> |
| 92 |
<?php Helper::renderLink($fluentCommunityLink, 'fcom_menu_link'); ?> |
| 93 |
</li> |
| 94 |
<?php endforeach; ?> |
| 95 |
</ul> |
| 96 |
</nav> |
| 97 |
</div> |
| 98 |
<?php endif; ?> |
| 99 |
<?php endforeach; ?> |
| 100 |
|
| 101 |
<?php if ($bottomLinkGroups): ?> |
| 102 |
<?php foreach ($bottomLinkGroups as $fluentCommunityBottomLink): ?> |
| 103 |
<?php |
| 104 |
$fluentCommunityBottomItems = isset($fluentCommunityBottomLink['items']) ? $fluentCommunityBottomLink['items'] : []; |
| 105 |
|
| 106 |
$fluentCommunityBottomCollapsedClass = in_array(sanitize_key((string) $fluentCommunityBottomLink['slug']), $fluentCommunityCollapsedGroups, true) |
| 107 |
? ' fcom_group_collapsed' |
| 108 |
: ''; |
| 109 |
?> |
| 110 |
<div class="<?php echo esc_attr('fcom_communities_menu' . $fluentCommunityBottomCollapsedClass); ?>"> |
| 111 |
<div class="fcom_space_group_header fcom_group_title"> |
| 112 |
<h4 role="button" tabindex="0" aria-expanded="<?php echo $fluentCommunityBottomCollapsedClass ? 'false' : 'true'; ?>" aria-label="<?php echo esc_attr($fluentCommunityBottomLink['title']); ?>" data-group_id="<?php echo esc_attr($fluentCommunityBottomLink['slug']); ?>" data-fcom-tip="<?php echo esc_attr($fluentCommunityBottomLink['title']); ?>" |
| 113 |
class="space_section_title"> |
| 114 |
<span><?php echo esc_html($fluentCommunityBottomLink['title']); ?></span> |
| 115 |
<i class="el-icon fcom_space_down"> |
| 116 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path></svg> |
| 117 |
</i> |
| 118 |
</h4> |
| 119 |
<?php if ($is_admin): ?> |
| 120 |
<div class="fcom_space_create"> |
| 121 |
<a href="<?php echo esc_url(Helper::baseUrl('admin/settings/menu-settings')); ?>"> |
| 122 |
+ |
| 123 |
</a> |
| 124 |
</div> |
| 125 |
<?php endif; ?> |
| 126 |
</div> |
| 127 |
<nav aria-label="Group Menu for <?php echo esc_html($fluentCommunityBottomLink['title']); ?>"> |
| 128 |
<ul> |
| 129 |
<?php foreach ($fluentCommunityBottomLink['items'] as $fluentCommunityButtomLink): ?> |
| 130 |
<li class="space_menu_item"> |
| 131 |
<?php Helper::renderLink($fluentCommunityButtomLink, 'fcom_menu_link space_menu_item route_url fcom_custom_link', '🔗'); ?> |
| 132 |
</li> |
| 133 |
<?php endforeach; ?> |
| 134 |
</ul> |
| 135 |
</nav> |
| 136 |
</div> |
| 137 |
<?php endforeach; ?> |
| 138 |
<?php endif; ?> |
| 139 |
|
| 140 |
|
| 141 |
<?php if ($settingsItems): ?> |
| 142 |
<div style="margin-top: 20px;"> |
| 143 |
<h4 class="space_section_title"><?php esc_html_e('# Manage', 'fluent-community'); ?></h4> |
| 144 |
<ul style="margin-top: 20px;"> |
| 145 |
<?php Helper::renderSettingsMenuItems($settingsItems); ?> |
| 146 |
</ul> |
| 147 |
</div> |
| 148 |
<?php endif; ?> |
| 149 |
</div> |
| 150 |
<?php endif; ?> |
| 151 |
</div> |
| 152 |
|
| 153 |
|
| 154 |
<?php if ($context != 'ajax'): ?> |
| 155 |
<?php do_action('fluent_community/after_sidebar_wrap', $context); ?> |
| 156 |
<div id="fcom_menu_sidebar"></div> |
| 157 |
<?php do_action('fluent_community/after_portal_sidebar', $context); ?> |
| 158 |
<?php endif; ?> |
| 159 |
|