Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget for Dashboards (OnManagerWelcomeHome) - remove a default widget #68

Closed
bossloper opened this issue Jul 19, 2017 · 5 comments
Closed

Comments

@bossloper
Copy link

Should I be able to remove a widget yet, or is this still work in progress?

From a simplified version of the example code a plugin for the OnManagerWelcomeHome event:

$e = &$modx->Event;
switch($e->name){
case 'OnManagerWelcomeHome':
unset($widgets['security']);
break;
}

But it does not remove the widget. Looking at the code here https://github.com/evolution-cms/evolution/blob/develop/manager/actions/welcome.static.php#L357 it is merging custom widgets, so as far as I can see the default ones will always be on the dashboard?

@Dmi3yy Dmi3yy closed this as completed in ffa6303 Jul 19, 2017
@Dmi3yy
Copy link

Dmi3yy commented Jul 19, 2017

i you use one plugin normal work unset($widgets['security']); but if use more then one better use

$widgets['security']['hide']='1';

@bossloper
Copy link
Author

I only have the default install, and so one plugin, but yes your solution works.... thanks.
Might be good to change the example help text for that.

@Dmi3yy
Copy link

Dmi3yy commented Jul 19, 2017

yes i change on pressreleases )

$e = &$modx->Event;
switch($e->name){
    case 'OnManagerWelcomeHome':
        //if($_SESSION['mgrRole']!=='2') return;
                
        //$widgets['welcome']['hide']='1';
        //$widgets['onlineinfo']['hide']='1';
        //$widgets['recentinfo']['hide']='1';
        //$widgets['news']['hide']='1';
        //$widgets['security']['hide']='1';
                
        $widgets['test'] = array(
            'menuindex' =>'1',
            'id' => 'test',
            'cols' => 'col-sm-6',
            'icon' => 'fa-rss',
            'title' => 'test',
            'body' => '<div class="card-body">[+modx_news_content+]</div>',
            'hide'=>'0'
        );
        $e->output(serialize($widgets));
    break;
}

@Nicola1971
Copy link

why does not work for me?

$e = &$modx->Event;
switch($e->name){
    case 'OnManagerWelcomeHome':
        //if($_SESSION['mgrRole']!=='2') return;
                
      $widgets['welcome']['hide']='1';
      $widgets['onlineinfo']['hide']='1';
      $widgets['recentinfo']['hide']='1';
      $widgets['news']['hide']='1';
      $widgets['security']['hide']='1';

        $e->output(serialize($widgets));
    break;
}

event: OnManagerWelcomeHome

what i'm doing wrong?
all default widgets are still visible

evo v 1.3.1

@Nicola1971 Nicola1971 reopened this Jul 20, 2017
@Dmi3yy
Copy link

Dmi3yy commented Jul 20, 2017

read plz this :)
https://github.com/evolution-cms/evolution/releases/tag/1.3.2

@Dmi3yy Dmi3yy closed this as completed Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants