2022-03-08 15:55:41 +01:00
|
|
|
<?php namespace ProcessWire;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ProcessWire ModulePlaceholder
|
|
|
|
*
|
|
|
|
* Holds the place for a Module until it is included and instantiated.
|
|
|
|
* As used by the Modules class.
|
|
|
|
*
|
2024-04-04 14:37:20 +02:00
|
|
|
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
|
2022-03-08 15:55:41 +01:00
|
|
|
* https://.processwire.com
|
|
|
|
*
|
|
|
|
* @property bool $autoload
|
|
|
|
* @property bool $singular
|
|
|
|
* @property string $file
|
|
|
|
* @property string $className
|
|
|
|
* @property string $class alias of className
|
|
|
|
* @property string $name alias of className
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
class ModulePlaceholder extends WireData implements Module {
|
|
|
|
|
|
|
|
protected $class = '';
|
|
|
|
protected $ns = '';
|
|
|
|
protected $moduleInfo = array();
|
|
|
|
|
|
|
|
public function __construct() {
|
2024-04-04 14:37:20 +02:00
|
|
|
parent::__construct();
|
2022-03-08 15:55:41 +01:00
|
|
|
$this->set('autoload', false);
|
|
|
|
$this->set('singular', true);
|
|
|
|
$this->set('file', '');
|
|
|
|
}
|
|
|
|
|
|
|
|
static public function getModuleInfo() {
|
|
|
|
return array(
|
|
|
|
'title' => 'ModulePlaceholder: call $modules->get(class) to replace this placeholder.',
|
|
|
|
'version' => 0,
|
|
|
|
'summary' => '',
|
2024-04-04 14:37:20 +02:00
|
|
|
);
|
2022-03-08 15:55:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function init() { }
|
|
|
|
public function ___install() { }
|
|
|
|
public function ___uninstall() { }
|
|
|
|
|
|
|
|
public function setClass($class) {
|
2024-04-04 14:37:20 +02:00
|
|
|
$this->class = (string) $class;
|
2022-03-08 15:55:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setNamespace($ns) {
|
2024-04-04 14:37:20 +02:00
|
|
|
$this->ns = (string) $ns;
|
2022-03-08 15:55:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function get($key) {
|
|
|
|
if($key == 'className' || $key == 'class' || $key == 'name') return $this->class;
|
|
|
|
return parent::get($key);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isSingular() {
|
|
|
|
return $this->singular;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isAutoload() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function className($options = null) {
|
|
|
|
if($options === true || !empty($options['namespace'])) {
|
2024-04-04 14:37:20 +02:00
|
|
|
return trim("$this->ns", '\\') . '\\' . $this->class;
|
2022-03-08 15:55:41 +01:00
|
|
|
}
|
|
|
|
return $this->class;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|