Differential D25078 Diff 361 src/applications/project/trigger/PhabricatorProjectTriggerPlaySoundRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/trigger/PhabricatorProjectTriggerPlaySoundRule.php
<?php | <?php | ||||
final class PhabricatorProjectTriggerPlaySoundRule | final class PhabricatorProjectTriggerPlaySoundRule | ||||
extends PhabricatorProjectTriggerRule { | extends PhabricatorProjectTriggerRule { | ||||
const TRIGGERTYPE = 'sound'; | const TRIGGERTYPE = 'sound'; | ||||
public function getSelectControlName() { | public function getSelectControlName() { | ||||
return pht('Play sound'); | return pht('Play Sound'); | ||||
} | } | ||||
protected function assertValidRuleRecordFormat($value) { | protected function assertValidRuleRecordFormat($value) { | ||||
if (!is_string($value)) { | if (!is_string($value)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Status rule value should be a string, but is not (value is "%s").', | 'Status Rule value should be a string, but is not (value is "%s").', | ||||
phutil_describe_type($value))); | phutil_describe_type($value))); | ||||
} | } | ||||
} | } | ||||
protected function assertValidRuleRecordValue($value) { | protected function assertValidRuleRecordValue($value) { | ||||
$map = self::getSoundMap(); | $map = self::getSoundMap(); | ||||
if (!isset($map[$value])) { | if (!isset($map[$value])) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Sound ("%s") is not a valid sound.', | 'Sound ("%s") is not a valid sound.', | ||||
$value)); | $value)); | ||||
} | } | ||||
} | } | ||||
protected function newDropTransactions($object, $value) { | protected function newDropTransactions($object, $value) { | ||||
return array(); | return array(); | ||||
} | } | ||||
protected function newDropEffects($value) { | protected function newDropEffects($value) { | ||||
$sound_icon = 'fa-volume-up'; | $sound_icon = 'fa-volume-up'; | ||||
$sound_color = 'blue'; | $sound_color = 'blue'; | ||||
$sound_name = self::getSoundName($value); | $sound_name = self::getSoundName($value); | ||||
$content = pht( | $content = pht( | ||||
'Play sound %s.', | 'Play Sound %s.', | ||||
phutil_tag('strong', array(), $sound_name)); | phutil_tag('strong', array(), $sound_name)); | ||||
return array( | return array( | ||||
$this->newEffect() | $this->newEffect() | ||||
->setIcon($sound_icon) | ->setIcon($sound_icon) | ||||
->setColor($sound_color) | ->setColor($sound_color) | ||||
->setContent($content), | ->setContent($content), | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0