private function renderRevertButton(PhrictionContent $content, PhrictionContent $current) { $document_id = $content->getDocumentID(); $version = $content->getVersion(); $hidden_statuses = array(PhrictionChangeType::CHANGE_DELETE => true, PhrictionChangeType::CHANGE_MOVE_AWAY => true, PhrictionChangeType::CHANGE_STUB => true); if (isset($hidden_statuses[$content->getChangeType()])) { // Don't show an edit/revert button for changes which deleted, moved or // stubbed the content since it's silly. return null; } if ($content->getID() == $current->getID()) { return phutil_tag('a', array('href' => '/phriction/edit/' . $document_id . '/', 'class' => 'button grey'), pht('Edit Current Version')); } return phutil_tag('a', array('href' => '/phriction/edit/' . $document_id . '/?revert=' . $version, 'class' => 'button grey'), pht('Revert to Version %s...', $version)); }
private function renderRevertButton(PhrictionContent $content, PhrictionContent $current) { $document_id = $content->getDocumentID(); $version = $content->getVersion(); if ($content->getChangeType() == PhrictionChangeType::CHANGE_DELETE) { // Don't show an edit/revert button for changes which deleted the content // since it's silly. return null; } if ($content->getID() == $current->getID()) { return phutil_render_tag('a', array('href' => '/phriction/edit/' . $document_id . '/', 'class' => 'button'), 'Edit Current Version'); } return phutil_render_tag('a', array('href' => '/phriction/edit/' . $document_id . '/?revert=' . $version, 'class' => 'button'), 'Revert to Version ' . phutil_escape_html($version) . '...'); }