Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'docs/198' into develop
Browse files Browse the repository at this point in the history
Forward port #198
  • Loading branch information
michalbundyra committed Oct 24, 2019
2 parents da6e996 + 06502ed commit dca8531
Showing 1 changed file with 64 additions and 64 deletions.
128 changes: 64 additions & 64 deletions docs/book/helpers/head-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,41 +71,41 @@ The `HeadStyle` helper is a concrete implementation of the
>
> class MyRenderer extends PhpRenderer
> {
> /**
> * @var string
> */
> protected $encoding;
>
> /**
> * Constructor
> *
> * @param string $encoding The encoding to be used
> */
> public function __construct($encoding)
> {
> parent::__construct();
> $this->encoding = $encoding;
> }
>
> /**
> * Sets the encoding
> *
> * @param string $encoding The encoding to be used
> */
> public function setEncoding($encoding)
> {
> $this->encoding = $encoding;
> }
>
> /**
> * Gets the encoding
> *
> * @return string The encoding being used
> */
> public function getEncoding()
> {
> return $this->encoding;
> }
> /**
> * @var string
> */
> protected $encoding;
>
> /**
> * Constructor
> *
> * @param string $encoding The encoding to be used
> */
> public function __construct($encoding)
> {
> parent::__construct();
> $this->encoding = $encoding;
> }
>
> /**
> * Sets the encoding
> *
> * @param string $encoding The encoding to be used
> */
> public function setEncoding($encoding)
> {
> $this->encoding = $encoding;
> }
>
> /**
> * Gets the encoding
> *
> * @return string The encoding being used
> */
> public function getEncoding()
> {
> return $this->encoding;
> }
> }
> ```
>
Expand All @@ -121,35 +121,35 @@ The `HeadStyle` helper is a concrete implementation of the
>
> class Module
> {
> public function getConfig(){/* ... */}
>
> public function getAutoloaderConfig(){/* ... */}
>
> public function getServiceConfig()
> {
> return [
> 'factories' => [
> // Register our custom renderer in the container
> 'MyCustomRenderer' => function ($container) {
> return new MyRenderer('ISO-8859-1');
> },
> 'MyCustomStrategy' => function ($container) {
> // As stated before, we just want to implement the
> // getEncoding() method, so we can use the base PhpRendererStrategy
> // and provide our custom renderer to it.
> $myRenderer = $container->get('MyCustomRenderer');
> return new PhpRendererStrategy($myRenderer);
> },
> ],
> ];
> }
>
> public function onBootstrap(MvcEvent $e)
> {
> // Register a render event
> $app = $e->getParam('application');
> $app->getEventManager()->attach('render', [$this, 'registerMyStrategy'], 100);
> }
> public function getConfig(){/* ... */}
>
> public function getAutoloaderConfig(){/* ... */}
>
> public function getServiceConfig()
> {
> return [
> 'factories' => [
> // Register our custom renderer in the container
> 'MyCustomRenderer' => function ($container) {
> return new MyRenderer('ISO-8859-1');
> },
> 'MyCustomStrategy' => function ($container) {
> // As stated before, we just want to implement the
> // getEncoding() method, so we can use the base PhpRendererStrategy
> // and provide our custom renderer to it.
> $myRenderer = $container->get('MyCustomRenderer');
> return new PhpRendererStrategy($myRenderer);
> },
> ],
> ];
> }
>
> public function onBootstrap(MvcEvent $e)
> {
> // Register a render event
> $app = $e->getParam('application');
> $app->getEventManager()->attach('render', [$this, 'registerMyStrategy'], 100);
> }
>
> public function registerMyStrategy(MvcEvent $e)
> {
Expand Down

0 comments on commit dca8531

Please sign in to comment.