Feature PR-5.0-dev Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
30 Apr 2023

Summary of Changes

The event that everyone waiting for :)
This should finally solve an issue everyone hit when need to access to Document at early stage, but onAfterRoute document not available and onAfterDispatch is to late.

PR also add a general Document event class, it introduce classes for 2 events: AfterInitialiseDocumentEvent, BeforeCompileHeadEvent

Note
Before we can merge this PR it would be good to add CMS\ApplicationEvent, and the document event should be a child of it (because technically it is Application event).
Thoughts?

Testing Instructions

Apply #40522 then apply current patch. Solve conflicts.
Add in any System plugin:

public function onAfterInitialiseDocument(Joomla\CMS\Event\Application\AfterInitialiseDocumentEvent $event)
{
    var_dump($event->getDocument()->getTitle());
}

Actual result BEFORE applying this Pull Request

Nothing

Expected result AFTER applying this Pull Request

You should see Dump output.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org: https://docs.joomla.org/Plugin/Events#System
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org: IDK
  • No documentation changes for manual.joomla.org needed
avatar joomla-cms-bot joomla-cms-bot - change - 30 Apr 2023
Category Libraries
avatar Fedik Fedik - open - 30 Apr 2023
avatar Fedik Fedik - change - 30 Apr 2023
Status New Pending
avatar Fedik Fedik - change - 30 Apr 2023
The description was changed
avatar Fedik Fedik - edited - 30 Apr 2023
avatar Fedik Fedik - change - 30 Apr 2023
Labels Added: PR-5.0-dev
avatar Fedik Fedik - change - 30 Apr 2023
The description was changed
avatar Fedik Fedik - edited - 30 Apr 2023
avatar Fedik Fedik - change - 30 Apr 2023
The description was changed
avatar Fedik Fedik - edited - 30 Apr 2023
avatar dgrammatiko
dgrammatiko - comment - 30 Apr 2023

Merge it!

avatar Fedik Fedik - change - 30 Apr 2023
The description was changed
avatar Fedik Fedik - edited - 30 Apr 2023
avatar Fedik
Fedik - comment - 30 Apr 2023

Note: I have removed Event classes from this PR, it is better to do separately, with all Application events.

avatar Fedik Fedik - change - 30 Apr 2023
The description was changed
avatar Fedik Fedik - edited - 30 Apr 2023
avatar HLeithner
HLeithner - comment - 30 Apr 2023

Note: I have removed Event classes from this PR, it is better to do separately, with all Application events.

Nope, all new events must have a corresponding class, also you don't provide the $document in the event now.

please revert your cleanup again.

avatar Fedik
Fedik - comment - 30 Apr 2023

all new events must have a corresponding class

I fully agree, but unfortunately here we have to wait when Application event classes will be implemented.
Doing it here will be like runing on front of a train.

I mean that PR should go first. Then classes can be added in this one.
I maybe try to preapre something later.

avatar Fedik Fedik - change - 7 May 2023
Labels Added: Feature
avatar Fedik Fedik - change - 7 May 2023
The description was changed
avatar Fedik Fedik - edited - 7 May 2023
avatar Fedik
Fedik - comment - 7 May 2023

I have re-added the event class, now it will work with #40522,
However, merge conflicts is expected :)

avatar HLeithner HLeithner - change - 21 Jul 2023
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-07-21 11:52:55
Closed_By HLeithner
avatar HLeithner HLeithner - close - 21 Jul 2023
avatar HLeithner HLeithner - merge - 21 Jul 2023
avatar HLeithner
HLeithner - comment - 21 Jul 2023

thanks

avatar HLeithner
HLeithner - comment - 21 Jul 2023

maybe we get a manual.joomla.org entry please?

avatar Fedik
Fedik - comment - 21 Jul 2023

I will make it.
Also will be need update https://docs.joomla.org/Plugin/Events#System

Add a Comment

Login with GitHub to post a comment