Use another module in our custom helper in zend framework 2

狂风中的少年 提交于 2019-12-06 11:59:44

The question that's left out is: What kind of entry is WebinoImageThumb. Is it a ViewHelper, is it a ControllerPlugin or is it a Service?

It probably isn't a ViewHelper, because if it would be, you could access it like you did.

If it's a Service, you'll get it from the ServiceManager

return new \Base\View\Helper\ImageLib(
    $sm->getServiceLocator()->get('WebinoImageThumb')
);

If it's a ControllerPlugin, you'll get it from the ControllerPluginManager

return new \Base\View\Helper\ImageLib(
    $sm->getServiceLocator()->get('ControllerPluginManager')->get('WebinoImageThumb')
);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!