Use template of another extension for acp

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

Use template of another extension for acp

Post by cangor » Fri Jan 12, 2018 2:10 pm

Hello,

I'm writing an extension ("child-extension") for another extension ("parent-extension"). Is there a way to re-use the acp-templates in the parent-extension for my child-extension? Of course I could just copy the files, but I would prefer using just the same files so that changes in the parent are used in my child at once.

Here https://area51.phpbb.com/docs/dev/3.2.x ... dules.html is written that you just have to set $this->tpl_name and put the corresponding file into /ext/child-company/child-extension/adm/style/, but I want to use the template in /ext/parent-company/parent-extension/adm/style/ instead.

I found here https://symfony.com/doc/current/templat ... paths.html that it should be possible to add more pathes in which symfony looks for templates, but I've no idea where/how to use the code with phpBB.

Any help is welcome.

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20855
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Use template of another extension for acp

Post by RMcGirr83 » Fri Jan 12, 2018 3:14 pm

Did you click on the PHP tab at the symfony link?
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

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

Re: Use template of another extension for acp

Post by cangor » Fri Jan 12, 2018 9:31 pm

Thanks for your reply.
RMcGirr83 wrote:
Fri Jan 12, 2018 3:14 pm
Did you click on the PHP tab at the symfony link?
Yes: Putting it in __constructor or main of my acp-module, it gives me an exception:

Code: Select all

GLOBAL $phpbb_container;

    $phpbb_container->loadFromExtension('child-company/child-extension', array(
    		'paths' => array(
    				'/ext/parrent-company/parent-extension/adm/style/' => 'theme',
    		),
    ));

Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\BadMethodCallException: 
Cannot load from an extension on a frozen container. in \vendor\symfony\dependency-injection\ContainerBuilder.php:282

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: alex75 and 7 guests