Path: blob/master/src/applications/countdown/xaction/PhabricatorCountdownTitleTransaction.php
12256 views
<?php12final class PhabricatorCountdownTitleTransaction3extends PhabricatorCountdownTransactionType {45const TRANSACTIONTYPE = 'countdown:title';67public function generateOldValue($object) {8return $object->getTitle();9}1011public function applyInternalEffects($object, $value) {12$object->setTitle($value);13}1415public function getTitle() {16return pht(17'%s updated the title for this countdown from %s to %s.',18$this->renderAuthor(),19$this->renderOldValue(),20$this->renderNewValue());21}2223public function getTitleForFeed() {24return pht(25'%s updated the title for this countdown from %s to %s.',26$this->renderAuthor(),27$this->renderOldValue(),28$this->renderNewValue());29}3031public function validateTransactions($object, array $xactions) {32$errors = array();3334if ($this->isEmptyTextTransaction($object->getTitle(), $xactions)) {35$errors[] = $this->newRequiredError(pht('Countdowns must have a title.'));36}3738$max_length = $object->getColumnMaximumByteLength('title');39foreach ($xactions as $xaction) {40$new_value = $xaction->getNewValue();41$new_length = strlen($new_value);42if ($new_length > $max_length) {43$errors[] = $this->newInvalidError(44pht(45'Countdown titles must not be longer than %s character(s).',46new PhutilNumber($max_length)));47}48}4950return $errors;51}5253}545556