Q:

How to include css and js files from controller using headLink helper

I am working on creating a global Function that will initialize all global and css files for my ZF2 application From Controller currently code looks like this
    /**
    ** Set Global media files for Application 
    ** Rest can be initialized in controllers
    **/
    private function setMedia() {

        $this->viewManager=new ViewModel;

        $this->viewManager->headLink()
        ->appendStylesheet(_CB_ASSETS_PATH_.'/css/docker.css', 'all', 'IE');
    return $this->viewManager;

    }

But issue is i got error
Fatal error: Call to undefined method Zend\View\Model\ViewModel::headLink() in C:\Apache24\htdocs\cartbiz\module\Front\src\Front\Model\FrontCore.php on line 59

Any help is greatly Appreciated
Thanks!

A:

Just this...
$this->getServiceLocator()->get('viewhelpermanager')->get('HeadLink')->appendStylesheet(_CB_ASSETS_PATH_ . '/css/docker.css', 'all', 'IE');

