Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/action/HeraldActionGroup.php
- This file was copied from src/applications/herald/field/HeraldFieldGroup.php.
<?php | <?php | ||||
abstract class HeraldFieldGroup extends Phobject { | abstract class HeraldActionGroup extends HeraldGroup { | ||||
abstract public function getGroupLabel(); | |||||
protected function getGroupOrder() { | |||||
return 1000; | |||||
} | |||||
final public function getGroupKey() { | final public function getGroupKey() { | ||||
$class = new ReflectionClass($this); | $class = new ReflectionClass($this); | ||||
$const = $class->getConstant('FIELDGROUPKEY'); | $const = $class->getConstant('ACTIONGROUPKEY'); | ||||
if ($const === false) { | if ($const === false) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'"%s" class "%s" must define a "%s" property.', | '"%s" class "%s" must define a "%s" property.', | ||||
__CLASS__, | __CLASS__, | ||||
get_class($this), | get_class($this), | ||||
'FIELDCONST')); | 'ACTIONGROUPKEY')); | ||||
} | } | ||||
return $const; | return $const; | ||||
} | } | ||||
public function getSortKey() { | final public static function getAllActionGroups() { | ||||
return sprintf('A%08d%s', $this->getGroupOrder(), $this->getGroupLabel()); | |||||
} | |||||
final public static function getAllFieldGroups() { | |||||
return id(new PhutilClassMapQuery()) | return id(new PhutilClassMapQuery()) | ||||
->setAncestorClass(__CLASS__) | ->setAncestorClass(__CLASS__) | ||||
->setUniqueMethod('getGroupKey') | ->setUniqueMethod('getGroupKey') | ||||
->setSortMethod('getSortKey') | ->setSortMethod('getSortKey') | ||||
->execute(); | ->execute(); | ||||
} | } | ||||
} | } |