Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102547864
PhabricatorUserRealNameField.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Feb 21, 21:22
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Feb 23, 21:22 (1 d, 5 h)
Engine
blob
Format
Raw Data
Handle
24356608
Attached To
rPH Phabricator
PhabricatorUserRealNameField.php
View Options
<?php
final
class
PhabricatorUserRealNameField
extends
PhabricatorUserCustomField
{
private
$value
;
public
function
getFieldKey
()
{
return
'user:realname'
;
}
public
function
getFieldName
()
{
return
pht
(
'Real Name'
);
}
public
function
getFieldDescription
()
{
return
pht
(
'Stores the real name of the user, like "Abraham Lincoln".'
);
}
public
function
canDisableField
()
{
return
false
;
}
public
function
shouldAppearInApplicationTransactions
()
{
return
true
;
}
public
function
shouldAppearInEditView
()
{
return
true
;
}
protected
function
didSetObject
(
PhabricatorCustomFieldInterface
$object
)
{
$this
->
value
=
$object
->
getRealName
();
}
public
function
getOldValueForApplicationTransactions
()
{
return
$this
->
getObject
()->
getRealName
();
}
public
function
getNewValueForApplicationTransactions
()
{
if
(!
$this
->
isEditable
())
{
return
$this
->
getObject
()->
getRealName
();
}
return
$this
->
value
;
}
public
function
applyApplicationTransactionInternalEffects
(
PhabricatorApplicationTransaction
$xaction
)
{
$this
->
getObject
()->
setRealName
(
$xaction
->
getNewValue
());
}
public
function
setValueFromRequest
(
AphrontRequest
$request
)
{
$this
->
value
=
$request
->
getStr
(
$this
->
getFieldKey
());
}
public
function
renderEditControl
()
{
return
id
(
new
AphrontFormTextControl
())
->
setName
(
$this
->
getFieldKey
())
->
setValue
(
$this
->
value
)
->
setLabel
(
$this
->
getFieldName
())
->
setDisabled
(!
$this
->
isEditable
());
}
private
function
isEditable
()
{
return
PhabricatorEnv
::
getEnvConfig
(
'account.editable'
);
}
}
Event Timeline
Log In to Comment