Skip to content

Commit 5e21789

Browse files
committed
Issues-648: Hide controls for MFE
1 parent f2059ac commit 5e21789

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

vanilla/applications/vanilla/controllers/class.vanillacontroller.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@ protected function buildBreadcrumbs($CategoryID) {
9595
$Category = CategoryModel::categories($CategoryID);
9696
$ancestors = CategoryModel::getAncestors($CategoryID);
9797
$parentCategoryID = val('ParentCategoryID', $Category);
98+
// FIX https://github.com/topcoder-platform/forums/issues/648
99+
if(getIncomingValue('embed_type') == 'mfe') {
100+
if(val('GroupID', $Category) > 0) {
101+
$temp = [];
102+
foreach ($ancestors as $id => $ancestor) {
103+
if ($ancestor['GroupID'] > 0) {
104+
$temp[$ancestor['CategoryID']] = $ancestor;
105+
}
106+
}
107+
return $temp;
108+
}
109+
}
110+
98111
if(val('GroupID', $Category) > 0) {
99112
$challenge = $this->data('Challenge');
100113
$track = $challenge ? $challenge['Track']: false;

vanilla/applications/vanilla/views/categories/helper_functions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,13 @@ function writeListItem($category, $depth) {
191191
<div class="CategoryDescription">
192192
<?php echo val('Description', $category) ?>
193193
</div>
194+
<?php if(getIncomingValue('embed_type') != 'mfe') { ?>
194195
<div class="Challenge">
195196
<?php
196197
Gdn::controller()->fireEvent('AfterChallenge', ['Category' =>$category]);
197198
?>
198199
</div>
200+
<?php } ?>
199201
<div class="Meta">
200202
<?php if (val('LastTitle', $category) != '') { ?>
201203
<span class="MItem LastDiscussionTitle">

vanilla/applications/vanilla/views/discussions/index.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
if($this instanceof CategoriesController) {
4949
echo discussionSorts();
5050
}
51-
echo Gdn_Theme::module('NewDiscussionModule', $this->data('_NewDiscussionProperties', ['CssClass' => 'Button Action Primary']));
51+
52+
if(getIncomingValue('embed_type') != 'mfe') {
53+
echo Gdn_Theme::module('NewDiscussionModule', $this->data('_NewDiscussionProperties', ['CssClass' => 'Button Action Primary']));
54+
}
5255
echo '</div>';
5356
echo '<div class="PageControls Top">';
5457
PagerModule::write($PagerOptions);
@@ -65,7 +68,9 @@
6568

6669
echo '<div class="PageControls Bottom">';
6770
PagerModule::write($PagerOptions);
68-
echo Gdn_Theme::module('NewDiscussionModule', $this->data('_NewDiscussionProperties', ['CssClass' => 'Button Action Primary']));
71+
if(getIncomingValue('embed_type') != 'mfe') {
72+
echo Gdn_Theme::module('NewDiscussionModule', $this->data('_NewDiscussionProperties', ['CssClass' => 'Button Action Primary']));
73+
}
6974
echo '</div>';
7075

7176
} else {

vanilla/library/core/class.theme.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public static function assetEnd() {
5858
* @return string
5959
*/
6060
public static function breadcrumbs($data, $homeLink = true, $options = []) {
61+
// FIX https://github.com/topcoder-platform/forums/issues/648
62+
if(getIncomingValue('embed_type') == 'mfe') {
63+
$homeLink = false;
64+
}
6165
$format = '<a href="{Url,html}" itemprop="url"><span itemprop="title">{Name,html}</span></a>';
6266

6367
$result = '';

0 commit comments

Comments
 (0)