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

Add the page to onMarkdownInitialized event #2412

Closed
Goutte opened this issue Mar 20, 2019 · 2 comments
Closed

Add the page to onMarkdownInitialized event #2412

Goutte opened this issue Mar 20, 2019 · 2 comments

Comments

@Goutte
Copy link
Contributor

Goutte commented Mar 20, 2019

A change suggestion to allow plugins hooking onMarkdownInitialized to mergeConfig to allow per-page configuration overrides.

system/src/Grav/Common/Markdown/ParsedownGravTrait.php
@@ -47,7 +47,10 @@ trait ParsedownGravTrait
         $this->setMarkupEscaped($defaults['escape_markup']);
         $this->setSpecialChars($defaults['special_chars']);
 
-        $grav->fireEvent('onMarkdownInitialized', new Event(['markdown' => $this]));
+        $grav->fireEvent('onMarkdownInitialized', new Event([
+            'markdown' => $this,
+            'page' => $page,
+        ]));
 
     }

Perhaps there's a better way? $event['markdown']->page is protected.


If I do make a PR about this, should it be a one-liner or like above?

@rhukster
Copy link
Member

Yes PR please...

Goutte added a commit to Goutte/grav that referenced this issue Mar 20, 2019
This will allow plugins hooking this event to mergeConfig.
Fix getgrav#2412
mahagr pushed a commit that referenced this issue Mar 25, 2019
This will allow plugins hooking this event to mergeConfig #2412
@mahagr mahagr added the fixed label Mar 25, 2019
@mahagr
Copy link
Member

mahagr commented Mar 25, 2019

@Goutte You can access it by $event['page'], DO NOT USE $event->page, it is different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants