-
Notifications
You must be signed in to change notification settings - Fork 5
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
Added invokeAll() method to defaultStyleguide::items() #24
base: 8.x-1.x
Are you sure you want to change the base?
Conversation
|
||
/** | ||
* @} End of "addtogroup hooks". | ||
*/ |
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.
Please add line break
…o alter(), code tidy
Thanks for the comments Andy, I'm still getting to grips with D8 so much appreciated. I've implemented your suggestions in my latest commit. |
@@ -759,8 +759,7 @@ public function items() { | |||
); | |||
|
|||
// Invoke hook_styleguide_alter() | |||
$items = \Drupal::service('module_handler')->invokeAll('styleguide_alter', array($items)); | |||
//$items->merge($new_items); | |||
\Drupal::service('module_handler')->alter('styleguide', $items); |
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.
It's already added to the class as dependency injection. So better to use $this->moduleHandler
@Shdulin - good catch! |
Thanks for your work, James! |
Hi, Thanks - I've updated alterInfo(), and it is invoking the hook. However, I can't work out how to pass the items through to hook_styleguide_alter(&$items). Any idea's? |
I suggest to use plugins to extend styleguide, alter only allows to change existing plugins defaults or swap plugin with own class |
@andypost - in that case, should we even have hooks? |
@jamesquinton that does not help because you needba plugin class to render something |
Thanks @andypost - took me a while to make sense of this, but got it working now. I have my own custom module, where I use hook_styleguide_alter to swap out the default plugin for my own, which is working very nicely! |
@jamesquinton that's great, could you update example in api definition to make that more clear how to use that? |
Hi - thanks for the work on a great and useful module!
I noticed that hook_styleguide_alter was not being invoked, which I need to be able to edit the items in the styleguide.
I may be on the wrong track here, but I have invoked the hook in defaultStyleguide:items().