1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-04 12:42:43 +01:00
phorge-phorge/src/applications/transactions/xaction/PhabricatorEditEngineDisableTransaction.php
Austin McKinley 6b9f4a918b Modularize PhabricatorEditEngineConfigurationTransaction
Summary: Ref T13319. Ref PHI1302. Migrate `PhabricatorEditEngineConfigurationTransaction` to modular transactions and add some additional transaction rendering to make these edits less opaque.

Test Plan: Hit all the form edit controllers, viewed resulting transaction timeline.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T13319

Differential Revision: https://secure.phabricator.com/D20595
2019-06-20 16:25:21 -07:00

51 lines
1,013 B
PHP

<?php
final class PhabricatorEditEngineDisableTransaction
extends PhabricatorEditEngineTransactionType {
const TRANSACTIONTYPE = 'editengine.config.disable';
public function generateOldValue($object) {
return (int)$object->getIsDisabled();
}
public function generateNewValue($object, $value) {
return (int)$value;
}
public function applyInternalEffects($object, $value) {
$object->setIsDisabled($value);
}
public function getTitle() {
$new = $this->getNewValue();
if ($new) {
return pht(
'%s disabled this form.',
$this->renderAuthor());
} else {
return pht(
'%s enabled this form.',
$this->renderAuthor());
}
}
public function getColor() {
$new = $this->getNewValue();
if ($new) {
return 'indigo';
} else {
return 'green';
}
}
public function getIcon() {
$new = $this->getNewValue();
if ($new) {
return 'fa-ban';
} else {
return 'fa-check';
}
}
}