config_text in main_module

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
Trubs
Registered User
Posts: 6
Joined: Thu Oct 04, 2018 7:03 pm

config_text in main_module

Post by Trubs »

How can I get access to config_text from main_module?

To config I get access like this:

Code: Select all

class main_module
{
	public $page_title;
	public $tpl_name;
	public $u_action;

	public function main($id, $mode)
	{
		global $config;
	}
}
There isn't a $config_text global variable :/
User avatar
GanstaZ
Registered User
Posts: 1187
Joined: Wed Oct 11, 2017 10:29 pm
Location: GZOverse

Re: config_text in main_module

Post by GanstaZ »

Add $phpbb_container and you can get it => $phpbb_container->get('config_text'); or what David said.
Last edited by GanstaZ on Sat Oct 06, 2018 2:44 pm, edited 1 time in total.
Usus est magister optimus! phpBB pre-Triton & latest php environment.
When answer lies in the question, question becomes redundant!
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: config_text in main_module

Post by david63 »

Rather than using main_module it is easier to use a controller where you can inject whatever you need (also it will save you having to convert your module to a controller at some point in the future)
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
Post Reply

Return to “Extension Writers Discussion”