Page MenuHomePhabricator
Paste P1943

Edit Engine Extension
ActivePublic

Authored by yelirekim on Feb 15 2016, 3:50 PM.
Tags
None
Referenced Files
F1112713: Edit Engine Extension
Feb 15 2016, 3:50 PM
Subscribers
None
<?php
final class CIEnforcementEngineExtension extends PhabricatorEditEngineExtension {
const EXTENSIONKEY = 'enforcement.owners';
public function isExtensionEnabled() {
return true;
}
public function getExtensionName() {
return pht('Enforcement Policies');
}
public function supportsObject(
PhabricatorEditEngine $engine,
PhabricatorApplicationTransactionInterface $object) {
return
$engine instanceof PhabricatorOwnersPackageEditEngine &&
$object instanceof PhabricatorOwnersPackage;
}
public function buildCustomEditFields(
PhabricatorEditEngine $engine,
PhabricatorApplicationTransactionInterface $object) {
return [
id(new PhabricatorDatasourceEditField())
->setKey('owners')
->setLabel(pht('Enforced Owners'))
->setDescription(pht('Users and projects which own the package.'))
->setIsLocked(true)
->setTransactionType(PhabricatorOwnersPackageTransaction::TYPE_OWNERS)
->setDatasource(new PhabricatorProjectOrUserDatasource())
->setIsCopyable(true)
->setValue($object->getOwnerPHIDs()),
];
}
}