FOF30\Generator\Command\Generate\Layout\LayoutBase::createViewFile PHP Méthode

createViewFile() protected méthode

Create the xml file for a give view type
protected createViewFile ( string $view, string $viewType, boolean $backend ) : string
$view string The view name
$viewType string The type of the view (default, form, item)
$backend boolean If it's for the backend
Résultat string The xml generated
    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;
    }