FOF30\Controller\DataController::read PHP Method

read() public method

Single record read. The id set in the request is passed to the model and then the item layout is used to render the result.
public read ( ) : void
return void
    public function read()
    {
        // Load the model
        /** @var DataModel $model */
        $model = $this->getModel()->savestate(false);
        // If there is no record loaded, try loading a record based on the id passed in the input object
        if (!$model->getId()) {
            $ids = $this->getIDsFromRequest($model, true);
            if ($model->getId() != reset($ids)) {
                $key = strtoupper($this->container->componentName . '_ERR_' . $model->getName() . '_NOTFOUND');
                throw new ItemNotFound(\JText::_($key), 404);
            }
        }
        // Set the layout to item, if it's not set in the URL
        if (empty($this->layout)) {
            $this->layout = 'item';
        } elseif ($this->layout == 'default') {
            $this->layout = 'item';
        }
        // Apply the Form name
        $formName = 'form.' . $this->layout;
        $this->getModel()->setFormName($formName);
        // Do we have a _valid_ form?
        $form = $this->getModel()->getForm($model);
        if ($form !== false) {
            $this->hasForm = true;
        }
        // Display the view
        $this->display(in_array('read', $this->cacheableTasks), $this->cacheParams);
    }