public function editAction($id = 0, $type = null)
{
if (!$id) {
$widget = Widget::create(['type' => $type]);
} else {
if (!($widget = Widget::find($id))) {
App::abort(404, 'Widget not found.');
}
}
return ['$view' => ['title' => __('Widgets'), 'name' => 'system/widget/edit.php'], '$data' => ['widget' => $widget, 'config' => ['menus' => App::menu(), 'nodes' => array_values(Node::query()->get()), 'roles' => array_values(Role::findAll()), 'types' => array_values(App::widget()->all()), 'positions' => array_values(App::position()->all())]]];
}