...
Ein Controller ist eine Methode in einer Controller-Klasse.
Codeblock |
---|
language | php |
---|
theme | RDark |
---|
title | Beispiel |
---|
linenumbers | true |
---|
|
namespace brandbox\component\example {
use brandbox\component\http;
class engine extends plugin\lib\engineAbstract {
/**
* @param int $max
* @return array
*/
public function index($max) {
return $this
->staticAppController(ui\lib\request\index::class)
->request($max)
;
}
/**
* @param int $max
* @return http\respondAbstract
*/
public function save($max) {
return $this
->staticAppController(ui\lib\execute\save::class)
->execute($max)
;
}
}
} |
...
Es gibt unterschiedliche Möglichkeiten auf fremde Plugins und dessen Controller zuzugreifen.
Codeblock |
---|
language | php | theme | RDark |
---|
title | Statischer Zugriff |
---|
collapse | true |
---|
|
public function abc() {
$this->staticAppController(foreign\engine::class)->something();
} |
Codeblock |
---|
language | php | theme | RDark |
---|
title | Zugriff mit neuer Controller-Instanz |
---|
collapse | true |
---|
|
public function abc() {
$this->newAppController(foreign\engine::class)->something();
} |
Codeblock |
---|
language | php | theme | RDark |
---|
title | Zugriff auf erstes Feature über Hook-System |
---|
collapse | true |
---|
|
public function abc() {
$result = $this
->main(foreign\engine::class)
->first()
->sendResponse()
->validateCsrf()
->validateRights()
->getResult($params, [])
;
} |
Codeblock |
---|
language | php | theme | RDark |
---|
title | Zugriff auf alle Features über Hook-System |
---|
collapse | true |
---|
|
public function abc() {
$result = $this
->main(foreign\engine::class)
->collectAll()
->sendResponse()
->validateCsrf()
->validateRights()
->getResult($params, [])
;
} |
Codeblock |
---|
language | php | theme | RDark |
---|
title | Erstellen eines Hooks |
---|
collapse | true |
---|
|
public function abc() {
$result = $this
->makeHookable(foreign\engine::class)
->something()
;
} |
...