phid = $phid; return $this; } private function getBlogPHID() { return $this->phid; } protected function getSideNavFilter() { return 'blog/delete/'.$this->getBlogPHID(); } protected function getSideNavExtraBlogFilters() { $filters = array( array('key' => $this->getSideNavFilter(), 'name' => 'Delete Blog') ); return $filters; } public function willProcessRequest(array $data) { $phid = $data['phid']; $this->setBlogPHID($phid); } public function processRequest() { $request = $this->getRequest(); $user = $request->getUser(); $blog = id(new PhameBlogQuery()) ->setViewer($user) ->withPHIDs(array($this->getBlogPHID())) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_EDIT, )) ->executeOne(); if (!$blog) { return new Aphront404Response(); } if ($request->isFormPost()) { $blog->delete(); return id(new AphrontRedirectResponse()) ->setURI('/phame/blog/?deleted'); } $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle('Delete blog?') ->appendChild('Really delete this blog? It will be gone forever.') ->addSubmitButton('Delete') ->addCancelButton($blog->getEditURI()); return id(new AphrontDialogResponse())->setDialog($dialog); } }