/**
* The default constructor. Automatically populates the $L member var with whatever language is currently being
* used. If a Data Type uses its own constructor, it should always call the parent constructor as well, to ensure
* $L is populated. ( parent::__construct($runtimeContext); )
*
* @param string $content "ui" / "generation". Data Types are instantiated in one of two contexts: once when
* the main UI page loads, so that the Data Type can be presented as an option for selection in the Data
* Generator, and secondly when we're actually actually generating the results. It's sometimes beneficial
* to only instantiate aspects of the class depending on the context.
*/
public function __construct($runtimeContext)
{
// a little magic to find the current instantiated class's folder
$currClass = new ReflectionClass(get_class($this));
$currClassFolder = dirname($currClass->getFileName());
$defaultLangFileStr = Core::getDefaultLanguageFile();
$currentLangFileStr = Core::$language->getCurrentLanguageFile();
$currentLangFile = $currClassFolder . "/lang/" . $currentLangFileStr . ".php";
$defaultLangFile = $currClassFolder . "/lang/" . $defaultLangFileStr . ".php";
if (file_exists($currentLangFile)) {
require $currentLangFile;
} else {
if (file_exists($defaultLangFile)) {
require $defaultLangFile;
}
}
if (isset($L)) {
$this->L = $L;
}
}