3.2 Access function in event-class from acp-module

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
cangor
Registered User
Posts: 39
Joined: Thu Oct 28, 2010 1:56 pm

3.2 Access function in event-class from acp-module

Post by cangor » Tue Nov 21, 2017 1:07 pm

Hello,

I have an extension with a class in /event/ which contains all the important functions of my extension. Then I implemented an acp-module, which worked fine so far. Now I need to access a function inside my event-class from the acp-module.

Whats the recommended way to get the instance of the event-class inside the acp-modul-cass?

User avatar
posey
Registered User
Posts: 546
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: 3.2 Access function in event-class from acp-module

Post by posey » Tue Nov 21, 2017 1:14 pm

Usually the "listener" is in the /event/ directory and not your functions used through out your extension.
However, have a look at the Board Rules ACP Module, Line 30. You can use the phpbb_container to get a service, which is declared within your services.yml.
Or if you're working with an admin controller yourself, which is declared in your services.yml, you can add the functions file through a dependency.
You can read more about that in the 3.2.x Extension Docs.
Ultimate Extensions:
Image Ultimate Blog (coming soon)
Image Ultimate Teams

''I'm pretty sure there's a lot more to life than being really, really, ridiculously good looking. And I plan on finding out what that is.''

cangor
Registered User
Posts: 39
Joined: Thu Oct 28, 2010 1:56 pm

Re: 3.2 Access function in event-class from acp-module

Post by cangor » Tue Nov 21, 2017 1:37 pm

Thank you! Using phpbb_container works.

But would you suggest putting all important functions into ext.php?

User avatar
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 23721
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: 3.2 Access function in event-class from acp-module

Post by Paul » Tue Nov 21, 2017 2:17 pm

cangor wrote:
Tue Nov 21, 2017 1:37 pm
But would you suggest putting all important functions into ext.php?
No.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: No registered users and 7 guests

cron