goFrendiAsgard / No-CMS

No-CMS, A CodeIgniter Based CMS Framework
300 stars 199 forks source link

deactivated widget still apear on webside #160

Open kal60 opened 8 years ago

kal60 commented 8 years ago

When I deactivate a widget via menu: cms-management => widget, it still appears when it's contained within the theme-layout-view (e.g. default-one-column.php) (e.g. calendar). So first question: if a widget is inactive is it supposed to disapear from the website no matter where it's referenced ? If yes: I changed the application/core/CMS-Model.php to hide the inactive widgets: in function cms_widgets():

       foreach (self::$__cms_model_properties['widget'] as $row) {
            if (isset($slug) && $slug != '') {
                if ($row->active != 1 || stripos($row->slug === null ? '' : $row->slug, $slug) === false) {
                    continue;
                }
            }

            # added code:
            if ($row->active != 1) { 
                    continue; # skip deactivated widgets
            }
            # end added code

            if (isset($widget_name)) {
                if (strtolower($row->widget_name) != strtolower($widget_name)) {
                    continue;
                }
            }
'''