Path: blob/master/src/applications/macro/xaction/PhabricatorMacroAudioBehaviorTransaction.php
12241 views
<?php12final class PhabricatorMacroAudioBehaviorTransaction3extends PhabricatorMacroTransactionType {45const TRANSACTIONTYPE = 'macro:audiobehavior';67public function generateOldValue($object) {8return $object->getAudioBehavior();9}1011public function applyInternalEffects($object, $value) {12$object->setAudioBehavior($value);13}1415public function getTitle() {16$new = $this->getNewValue();17$old = $this->getOldValue();18switch ($new) {19case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_ONCE:20return pht(21'%s set the audio to play once.',22$this->renderAuthor());23case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_LOOP:24return pht(25'%s set the audio to loop.',26$this->renderAuthor());27default:28return pht(29'%s disabled the audio for this macro.',30$this->renderAuthor());31}32}3334public function getTitleForFeed() {35$new = $this->getNewValue();36$old = $this->getOldValue();37switch ($new) {38case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_ONCE:39return pht(40'%s set the audio for %s to play once.',41$this->renderAuthor(),42$this->renderObject());43case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_LOOP:44return pht(45'%s set the audio for %s to loop.',46$this->renderAuthor(),47$this->renderObject());48default:49return pht(50'%s disabled the audio for %s.',51$this->renderAuthor(),52$this->renderObject());53}54}5556public function getIcon() {57$new = $this->getNewValue();58switch ($new) {59case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_ONCE:60return 'fa-play-circle';61case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_LOOP:62return 'fa-repeat';63default:64return 'fa-pause-circle';65}66}6768}697071