Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F468782
PhabricatorDashboardPanelNameTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorDashboardPanelNameTransaction.php
View Options
<?php
final
class
PhabricatorDashboardPanelNameTransaction
extends
PhabricatorDashboardPanelTransactionType
{
const
TRANSACTIONTYPE
=
'dashpanel:name'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getName
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setName
(
$value
);
}
public
function
getTitle
()
{
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
return
pht
(
'%s renamed this panel from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderOldValue
(),
$this
->
renderNewValue
());
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
$max_length
=
$object
->
getColumnMaximumByteLength
(
'name'
);
foreach
(
$xactions
as
$xaction
)
{
$new
=
$xaction
->
getNewValue
();
if
(!
strlen
(
$new
))
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Panels must have a title.'
),
$xaction
);
continue
;
}
if
(
strlen
(
$new
)
>
$max_length
)
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Panel names must not be longer than %s characters.'
,
$max_length
));
continue
;
}
}
if
(!
$errors
)
{
if
(
$this
->
isEmptyTextTransaction
(
$object
->
getName
(),
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Panels must have a title.'
));
}
}
return
$errors
;
}
public
function
getTransactionTypeForConduit
(
$xaction
)
{
return
'name'
;
}
public
function
getFieldValuesForConduit
(
$xaction
,
$data
)
{
return
array
(
'old'
=>
$xaction
->
getOldValue
(),
'new'
=>
$xaction
->
getNewValue
(),
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 6, 6:39 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
80953
Default Alt Text
PhabricatorDashboardPanelNameTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment