@Zeichen32 opened this Pull Request on June 26th 2015 Contributor

In relation to PR #7979

This OptOut Manager allows plugins to add Javascripts and Stylesheets to the OptOut View.

  • [x] Add a new OptOutManager
  • [x] Remove opt out logic from CoreAdminHome Controller
  • [x] Change OptOut View
@mnapoli commented on June 26th 2015 Member

Could you sum up how plugins would add CSS and JS to the form? I see the OptOutManager:: addStylesheet() and OptOutManager:: addJavascript() methods but where/when are plugins supposed to call them?

@Zeichen32 commented on June 26th 2015 Contributor

My current idea is to create a EventListener for the "Controller.CoreAdminHome.optOut" Event.
But maybe it is better to dispatch a seperate event?

    /**
     * <a class='mention' href='https://github.com/see'>@see</a> Piwik\Plugin::getListHooksRegistered
     */
    public function getListHooksRegistered()
    {
        return array(
            'Controller.CoreAdminHome.optOut' => 'addOptOutStyles'
        );
    }

    public function addOptOutStyles()
    {
        StaticContainer::get('Piwik\Plugins\CoreAdminHome\OptOutManager')
            ->addStylesheet('body { background: black; }');
    }
@tsteur commented on June 28th 2015 Owner

It will be nice to have an OptOutManager soon. With Piwik 3.0 we should even consider making it public API IMO.

@Zeichen32 commented on July 1st 2015 Contributor

@tsteur I have added a new commit.

@tsteur commented on July 1st 2015 Owner

Cheers! @mattab @mnapoli @diosmosis does any of you mind to have a quick look as well?

@mattab commented on July 12th 2015 Owner

Looks good to me :+1:

@Zeichen32 you will be able to test this in 2.14.1-b1

@Zeichen32 commented on July 13th 2015 Contributor

:+1: thanks for merge :sunglasses:

This Pull Request was closed on July 12th 2015
Powered by GitHub Issue Mirror