ibelar / atk-wordpress

Wordpress plugin development using Agile Toolkit Framework (atk). Wordpress site demo available on www.atkwp.com
8 stars 7 forks source link

Who's working on this? #20

Open RobertMassart opened 4 years ago

RobertMassart commented 4 years ago

I'm trying to work with this kit but I really need full CRUD working in both backend and frontend. Can't get anywhere with this. Tried to get the event model from the sample demo working but I just get exceptions in the code base.

My sample ShortcodeComponent:

namespace atkdemo\shortcodes;

use atk4\ui\View; use atkdemo\models\Event;

use atkwp\components\ShortcodeComponent;

class EventShortcode extends ShortcodeComponent { public function init() { parent::init();

    $msg = $this->add([
        'Message',
        'Agile Toolkit for Wordpress!',
    ]);

    $m = new Event($this->getDbConnection(), ['table' => $this->getPluginInstance()->getDbTableName('event')]);

    //$table = $this->add('Table');
    //$table->setModel($m);

    $v = $this->add(new View(['ui' => 'segment']));
    $c = $v->add(['CRUD', 'notifyDefault' => new \atk4\ui\jsNotify(['content'=>'Data saved'], $this)]);
    $c->setModel($m);
    $c->itemCreate->set('Event');
}

}