@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at upstream/main 63 lines 1.6 kB view raw
1<?php 2 3final class PhrictionDocumentStatus 4 extends PhabricatorObjectStatus { 5 6 const STATUS_EXISTS = 'active'; 7 const STATUS_DELETED = 'deleted'; 8 const STATUS_MOVED = 'moved'; 9 const STATUS_STUB = 'stub'; 10 11 public static function getConduitConstant($const) { 12 static $map = array( 13 self::STATUS_EXISTS => 'exists', 14 self::STATUS_DELETED => 'deleted', 15 self::STATUS_MOVED => 'moved', 16 self::STATUS_STUB => 'stubbed', 17 ); 18 19 return idx($map, $const, 'unknown'); 20 } 21 22 public static function newStatusObject($key) { 23 return new self($key, id(new self())->getStatusSpecification($key)); 24 } 25 26 public static function getStatusMap() { 27 $map = id(new self())->getStatusSpecifications(); 28 return ipull($map, 'name', 'key'); 29 } 30 31 public function isActive() { 32 return ($this->getKey() == self::STATUS_EXISTS); 33 } 34 35 protected function newStatusSpecifications() { 36 return array( 37 array( 38 'key' => self::STATUS_EXISTS, 39 'name' => pht('Active'), 40 'icon' => 'fa-file-text-o', 41 'color' => 'bluegrey', 42 ), 43 array( 44 'key' => self::STATUS_DELETED, 45 'name' => pht('Deleted'), 46 'icon' => 'fa-file-text-o', 47 'color' => 'grey', 48 ), 49 array( 50 'key' => self::STATUS_MOVED, 51 'name' => pht('Moved'), 52 'icon' => 'fa-arrow-right', 53 'color' => 'grey', 54 ), 55 array( 56 'key' => self::STATUS_STUB, 57 'name' => pht('Stub'), 58 'icon' => 'fa-file-text-o', 59 'color' => 'grey', 60 ), 61 ); 62 } 63}