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
Add OptOutManager #8229
Add OptOutManager #8229
Conversation
Could you sum up how plugins would add CSS and JS to the form? I see the |
My current idea is to create a EventListener for the "Controller.CoreAdminHome.optOut" Event. /**
* @see 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; }');
} |
* @return View | ||
* @throws \Exception | ||
*/ | ||
public function createView() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering if the code of this method could be as well in the controller? Or is it supposed to be here so one can override it? Do you need this feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, i didn't need to to override the optout manager, but the "createView" method include the whole optout logic. In my opinion the right place for this code is in the OptOut Manager, not the controller.
The other reason because i have moved the code into the OptOut Manager is that plugins can extends or use the OptOut Manager for their own needs.
It will be nice to have an |
@tsteur I have added a new commit. |
Cheers! @mattab @mnapoli @diosmosis does any of you mind to have a quick look as well? |
Looks good to me 👍 @Zeichen32 you will be able to test this in 2.14.1-b1 |
👍 thanks for merge 😎 |
In relation to PR #7979
This OptOut Manager allows plugins to add Javascripts and Stylesheets to the OptOut View.