Last active
October 20, 2017 10:29
-
-
Save holantomas/910757baf51618ecf3b43f47ef3e7034 to your computer and use it in GitHub Desktop.
Ukazka Nette komponenty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
- IFooControlFactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p n:foreach="$flashes as $flash">{$flash->message}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Nette\Application\UI\Control; | |
class FooControl extends Control { | |
/** @var SomeDependecy */ | |
private $depend; | |
public function (SomeDependecy $depend) { | |
$this->depend = $depend; | |
$this->getTemplate()->setFile(__DIR__ . DIRECTORY_SEPARATOR . "foo.latte"); | |
} | |
public function handleShowFlashmessage() { | |
$this->flashMessage('Hello world'); | |
$this->redrawControl(); | |
} | |
public function render() { | |
$this->getTemplate()->render(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interaface IFooControlFactory { | |
/** | |
* @return FooControl | |
*/ | |
public function create(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Presenter { | |
/** @var IFooControlFactory @inject */ | |
public $fooControlFactory; | |
/** | |
* @return FooControl | |
*/ | |
protected function createComponentFoo() { | |
return $this->fooControlFactory->create(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment