View_CRUD::init PHP Method

init() public method

CRUD's init() will create either a grid or form, depending on isEditing(). You can then do the necessary changes after Note, that the form or grid will not be populated until you call setModel()
public init ( )
    public function init()
    {
        parent::init();
        $this->js_reload = $this->js()->reload();
        // Virtual Page would receive 3 types of requests - add, delete, edit
        $this->virtual_page = $this->add('VirtualPage', array('frame_options' => $this->frame_options));
        /** @type VirtualPage $this->virtual_page */
        $name_id = $this->virtual_page->name . '_id';
        /*
                if ($_GET['edit'] && !isset($_GET[$name_id])) {
           $_GET[$name_id] = $_GET['edit'];
                }
        */
        if (isset($_GET[$name_id])) {
            $this->app->stickyGET($name_id);
            $this->id = $_GET[$name_id];
        }
        if ($this->isEditing()) {
            $this->form = $this->virtual_page->getPage()->add($this->form_class, $this->form_options);
            /** @type Form $this->form */
            $this->grid = new Dummy();
            /** @type Grid $this->grid */
            return;
        }
        $this->grid = $this->add($this->grid_class, $this->grid_options);
        /** @type Grid $this->grid */
        $this->form = new Dummy();
        /** @type Form $this->form */
        // Left for compatibility
        $this->js('reload', $this->grid->js()->reload());
        if ($this->allow_add) {
            $this->add_button = $this->grid->addButton('Add');
        }
    }