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
hide annotation with tests #6382
Conversation
@@ -23,7 +23,8 @@ public function getListHooksRegistered() | |||
{ | |||
return array( | |||
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', | |||
"TestingEnvironment.addHooks" => 'setupTestEnvironment' | |||
"TestingEnvironment.addHooks" => 'setupTestEnvironment', | |||
'API.DocumentationGenerator.hideExceptForSuperUser' => 'checkIfNotSuperUser' |
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.
this code is not needed?
Hi @d-skora, thanks for PR. I notice the build failed with a php notice. |
Fixed up things, now it works correctly with classes and methods. |
@mattab - any update on this? Can this be merged into Core before 2.8.1 ? |
* @param bool &$response Boolean value containing information | ||
* if the plugin API should be hidden from the current user. | ||
*/ | ||
Piwik::postEvent(sprintf('API.DocumentationGenerator.%s', $hideString), array(&$response)); |
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.
the event is not necessary as we need only hideExceptSuperUser
for this PR
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.
As discussed with @mgazdzik - this PR should be more generic and flexible. Creating custom hook in this place gives us the ability to easily define our custom annotation and their behavior. As long this is core feature, not specific plugin we should look at this problem with wider perspective. Creating hard coded solutions in core is bad approach in Piwik architecture and we should avoid this.
Thanks for PR! |
Added @hide annotation.
@hide takes up to one argument.
If there's no argument @hide will always hide the annotated plugin's API.
If the argument is set then there is a API.DocumentGenerator.hide event dispatched.
The event should be handled in the plugin and it should set the &$response to true if the plugin API should be hidden from the current user or false if the user should be able to see the plugin API.