public function shouldEnableForRole($role) { switch ($role) { case self::ROLE_COMMITMESSAGE: return $this->shouldAppearInCommitMessage(); case self::ROLE_COMMITMESSAGEEDIT: return $this->shouldAppearInCommitMessage() && $this->shouldAllowEditInCommitMessage(); } return parent::shouldEnableForRole($role); }
public function addField(PhabricatorCustomField $field) { $role_storage = PhabricatorCustomField::ROLE_STORAGE; if (!$field->shouldEnableForRole($role_storage)) { return $this; } $storage = $field->newStorageObject(); $source_key = $storage->getStorageSourceKey(); $this->fieldMap[$source_key][] = $field; if (empty($this->storageSources[$source_key])) { $this->storageSources[$source_key] = $storage; } return $this; }