FOF30\Generator\Command\Generate\Layout\LayoutBase::createView PHP Method

createView() protected method

Create the view
protected createView ( string $viewType )
$viewType string The type of the view (item, default, form)
    protected function createView($viewType)
    {
        $this->setDevServer();
        $view = $this->getViewName($this->input);
        if (!$this->component) {
            $this->out("Can't find component details in composer.json file. Run 'fof init'");
            exit;
        }
        if (!$view) {
            $this->out("Syntax: fof generate " . $viewType . "view <name>");
            exit;
        }
        // Backend or frontend?
        $backend = !$this->input->get('frontend', false);
        try {
            // Create the view
            $this->createViewFile($view, $viewType, $backend);
            $message = $backend ? "Backend" : "Frontend";
            $message .= " " . $viewType . " view for " . $view . ' created!';
            // All ok!
            $this->out($message);
        } catch (\Exception $e) {
            if ($e instanceof NoTableColumns) {
                $container = Container::getInstance($this->component);
                $this->out("FOF cannot find a database table for " . $view . '. It should be named #__' . $this->component . '_' . strtolower($container->inflector->pluralize($view)));
                exit;
            }
            $this->out($e);
            exit;
        }
    }