protected function createViewFile($view, $viewType, $backend)
{
// Let's force the use of the Magic Factory
$container = Container::getInstance($this->component, array('factoryClass' => 'FOF30\\Factory\\MagicFactory'));
$container->factory->setSaveScaffolding(true);
// plural / singular
if ($viewType != 'default') {
$view = $container->inflector->singularize($view);
}
// Small trick: being in the CLI, the builder always tries to build in the frontend
// Let's switch paths :)
$originalFrontendPath = $container->frontEndPath;
$originalBackendPath = $container->backEndPath;
$container->frontEndPath = $backend ? $container->backEndPath : $container->frontEndPath;
$scaffolding = new LayoutBuilder($container);
$return = $scaffolding->make('form.' . $viewType, $view);
// And switch them back!
$container->frontEndPath = $originalFrontendPath;
$container->backEndPath = $originalBackendPath;
return $return;
}