private function takeWidgetFromURI(RequestContext $context) { try { return Widget::getByID($context->takeNextPathComponent()); } catch (\Chipin\Widgets\NoSuchWidget $_) { return $this->pageNotFound("No such widget"); } }
public function endWidget(RequestContext $context) { $w = Widget::getByOwnerAndID($this->user, $context->takeNextPathComponent()); if ($this->isPostRequest()) { Widgets\endWidget($w); return $this->redirect('/dashboard/'); } else { return $this->render('end-widget.diet-php', array('widget' => $w)); } }