Pagekit\Site\Controller\NodeController::editAction PHP Метод

editAction() публичный Метод

public editAction ( $id = '', $menu = '' )
    public function editAction($id = '', $menu = '')
    {
        if (is_numeric($id)) {
            if (!$id or !($node = Node::find($id))) {
                App::abort(404, 'Node not found.');
            }
        } else {
            $node = Node::create(['type' => $id]);
            if ($menu && !App::menu($menu)) {
                App::abort(404, 'Menu not found.');
            }
            $node->menu = $menu;
        }
        if (!($type = $this->site->getType($node->type))) {
            App::abort(404, 'Type not found.');
        }
        return ['$view' => ['title' => __('Pages'), 'name' => 'system/site/admin/edit.php'], '$data' => ['node' => $node, 'type' => $type, 'roles' => array_values(Role::findAll())]];
    }