Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>With ZF 2.2.1 (not sure that's possible with the previous versions), you can just add your helper withtut injecting anything</p> <pre><code># module.config.php ... 'view_helpers' =&gt; array( 'invokables' =&gt; array( 'yourHelper' =&gt; 'Application\View\Helper\YourHelper', ), </code></pre> <p>), ...</p> <p>And write <code>YourHelper</code> implementing the interface <strong><code>Zend\ServiceManager\ServiceLocatorAwareInterface</code></strong>. You'll have to implement the two methods of the interface (simple setter and getters). You can now access the service locator, and get the configuration:</p> <pre><code>namespace Application\View\Helper; class YourHelper implements Zend\ServiceManager\ServiceLocatorAwareInterface { public function __invoke() { $config = $this-&gt;getServiceLocator()-&gt;getServiceLocator()-&gt;get('Config'); // $config is the object you need return $config; } public function getServiceLocator() { return $this-&gt;serviceLocator; } public function setServiceLocator(\Zend\ServiceManager\ServiceLocatorInterface $serviceLocator) { $this-&gt;serviceLocator = $serviceLocator; return $this; } } </code></pre> <p>More info at <a href="http://robertbasic.com/blog/working-with-custom-view-helpers-in-zend-framework-2" rel="noreferrer">http://robertbasic.com/blog/working-with-custom-view-helpers-in-zend-framework-2</a></p> <p>An helper to access the config here <a href="https://gist.github.com/elvisciotti/6592837" rel="noreferrer">https://gist.github.com/elvisciotti/6592837</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload