Reputation: 6190
I have a file called Message.php
in module/Cms/language
directory. This file contain constants like below
<?php
define("APPLICATION_TITLE","Test Application");
?>
When module is running I would like to use such constant anywhere in the module scope. I understand I can load this by modifying config_glob_paths
in application.config.php
But I am looking for a way where this file will be loaded only for the module specified. Can I have some configuration in module.config.php
for this. Appreciate your guidance.
Upvotes: 0
Views: 153
Reputation: 792
To define the contants when the module CMS
loads use the Module::onBootstrap()
method.
class Module
{
public function onBootstrap(Event $e)
{
include_once( __DIR__ . '/language/English.php');
}
}
More information about the bootstrap event is documented here.
Optionally the Module class can implement the Zend\ModuleManager\Listener\OnBootstrapListener
. Which is documented here.
Upvotes: 1