Use template of another extension for acp

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

Use template of another extension for acp

Post by cangor »

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
Former Team Member
Posts: 22016
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Use template of another extension for acp

Post by RMcGirr83 »

Did you click on the PHP tab at the symfony link?
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
cangor
Registered User
Posts: 86
Joined: Thu Oct 28, 2010 1:56 pm

Re: Use template of another extension for acp

Post by cangor »

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”