Id like to see how the base path view helper
sets up the base path variable inside the helper class.
This is an internal based questions, as I imagine its being done with a factory behind the scenes.
I needed to replicate it with a custom version but im hardcoding the base path currently: You'll see that even though its extending the basepath viewhelper i cannot configure the basepath variable without this current solution of hardcoding it
class PlutoBasePath extends \Zend\View\Helper\BasePath
{
public function __construct()
{
/**
* @todo
* @var Ambiguous $basePath
*/
$this->basePath = Pluto::registry('prepend_location_url');
}
public function __invoke($file = null)
{
if (null === $this->basePath) {
throw new Exception\RuntimeException('No base path provided');
}
if (null !== $file) {
\Pluto\Stdlib\FilesystemUtils::sanitizeFilePaths($file);
\Pluto\Stdlib\FilesystemUtils::trimLeadingPath($file);
}
return $this->basePath.$file;
}
}
Id rather use a factory but I dont know how to access the base path set logic WHICH SETS UP THE FACTORY BASE PATH FOR THE base path view helper to setup the custom base path correctly
How is it possible for me to see the factory creation of the base path view helper is my base question
I seem to have found where the basepath is set, here
Zend\Mvc\Service\ViewHelperManagerFactory::createBasePathHelperFactory()
.I hope this helps