Skip to content

Commit

Permalink
fix modxcms#68 (for hide widget better use $widgets['welcome']['hide'…
Browse files Browse the repository at this point in the history
…] = 1;)
  • Loading branch information
Dmi3yy committed Jul 19, 2017
1 parent f1ec7e9 commit ffa6303
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions manager/actions/welcome.static.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,47 +315,54 @@
<!--@ENDIF-->
</table>
</div>
'
',
'hide'=>'0'
);
$widgets['onlineinfo'] = array(
'menuindex' => '20',
'id' => 'onlineinfo',
'cols' => 'col-sm-6',
'icon' => 'fa-user',
'title' => '[%onlineusers_title%]',
'body' => '<div class="userstable">[+OnlineInfo+]</div>'
'body' => '<div class="userstable">[+OnlineInfo+]</div>',
'hide'=>'0'
);
$widgets['recentinfo'] = array(
'menuindex' => '30',
'id' => 'modxrecent_widget',
'cols' => 'col-sm-12',
'icon' => 'fa-pencil-square-o',
'title' => '[%activity_title%]',
'body' => '<div class="widget-stage">[+RecentInfo+]</div>'
'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
'hide'=>'0'
);
$widgets['news'] = array(
'menuindex' => '40',
'id' => 'news',
'cols' => 'col-sm-6',
'icon' => 'fa-rss',
'title' => '[%modx_news_title%]',
'body' => '<div style="max-height:200px;overflow-y: scroll;padding: 1rem .5rem">[+modx_news_content+]</div>'
'body' => '<div style="max-height:200px;overflow-y: scroll;padding: 1rem .5rem">[+modx_news_content+]</div>',
'hide'=>'0'
);
$widgets['security'] = array(
'menuindex' => '50',
'id' => 'security',
'cols' => 'col-sm-6',
'icon' => 'fa-exclamation-triangle',
'title' => '[%security_notices_title%]',
'body' => '<div style="max-height:200px;overflow-y: scroll;padding: 1rem .5rem">[+modx_security_notices_content+]</div>'
'body' => '<div style="max-height:200px;overflow-y: scroll;padding: 1rem .5rem">[+modx_security_notices_content+]</div>',
'hide'=>'0'
);

// invoke OnManagerWelcomeHome event
$sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
if(is_array($sitewidgets)) {
$newwidgets = array();
foreach($sitewidgets as $widget){
$widgets = array_merge($widgets, unserialize($widget));
$newwidgets = array_merge($newwidgets, unserialize($widget));
}
$widgets = $newwidgets;
}

usort($widgets, function ($a, $b) {
Expand All @@ -365,7 +372,9 @@
$tpl = getTplWidget();
$output = '';
foreach($widgets as $widget) {
$output .= $modx->parseText($tpl, $widget);
if ($widget['hide'] != '1'){
$output .= $modx->parseText($tpl, $widget);
}
}
$ph['widgets'] = $output;

Expand Down Expand Up @@ -606,4 +615,4 @@ function hideConfigCheckWarning(key) {
</script>
';
return $script;
}
}

0 comments on commit ffa6303

Please sign in to comment.