Revert "Revert "Replace Module::init() with Constructors""

This reverts commit 89d6c89b67.
This commit is contained in:
Philipp 2021-11-19 20:18:48 +01:00
parent 942001b04d
commit 645e4edc63
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
43 changed files with 1226 additions and 922 deletions

View file

@ -21,6 +21,8 @@
namespace Friendica;
use Friendica\Core\L10n;
/**
* This mock module enable class encapsulation of legacy global function modules.
* After having provided the module file name, all the methods will behave like a normal Module class.
@ -37,11 +39,13 @@ class LegacyModule extends BaseModule
*/
private $moduleName = '';
public function __construct(string $file_path = '', array $parameters = [])
public function __construct(L10n $l10n, string $file_path = '', array $parameters = [])
{
parent::__construct($parameters);
parent::__construct($l10n, $parameters);
$this->setModuleFile($file_path);
$this->runModuleFunction('init');
}
/**
@ -61,11 +65,6 @@ class LegacyModule extends BaseModule
require_once $file_path;
}
public function init()
{
$this->runModuleFunction('init');
}
public function content(): string
{
return $this->runModuleFunction('content');