__construct()
The class is executed after initialization, transferring the values from the settings page to the variable.
You can import the SMS service API files as in the example.
Parameters;
- $external_config - sends the same data as the value in the “config.php” file.
public function __construct($external_config=[])
{
$this->lang = Modules::Lang("SMS",__CLASS__);
if(!class_exists("ExampleSMS_API")) include __DIR__.DS."api.php";
$config = Modules::Config("SMS",__CLASS__);
$this->config = $config;
$external = $external_config ? $external_config : [];
$config = array_merge($config,$external);
$this->config = $config;
$this->title = $config["origin"];
$this->instance = new ExampleSMS_API();
$this->instance->set_credentials($config["api-token"]);
}