Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97909210
PhabricatorSpacesControl.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
Tue, Jan 7, 11:10
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jan 9, 11:10 (2 d)
Engine
blob
Format
Raw Data
Handle
23437631
Attached To
rPH Phabricator
PhabricatorSpacesControl.php
View Options
<?php
final
class
PhabricatorSpacesControl
extends
AphrontFormControl
{
private
$object
;
protected
function
shouldRender
()
{
// Render this control only if some Spaces exist.
return
PhabricatorSpacesNamespaceQuery
::
getAllSpaces
();
}
public
function
setObject
(
PhabricatorSpacesInterface
$object
)
{
$this
->
object
=
$object
;
return
$this
;
}
protected
function
getCustomControlClass
()
{
return
''
;
}
protected
function
getOptions
()
{
$viewer
=
$this
->
getUser
();
$viewer_spaces
=
PhabricatorSpacesNamespaceQuery
::
getViewerSpaces
(
$viewer
);
$map
=
mpull
(
$viewer_spaces
,
'getNamespaceName'
,
'getPHID'
);
asort
(
$map
);
return
$map
;
}
public
function
renderInput
()
{
$viewer
=
$this
->
getUser
();
$this
->
setLabel
(
pht
(
'Space'
));
$value
=
$this
->
getValue
();
if
(
$value
===
null
)
{
$value
=
$viewer
->
getDefaultSpacePHID
();
}
return
AphrontFormSelectControl
::
renderSelectTag
(
$value
,
$this
->
getOptions
(),
array
(
'name'
=>
$this
->
getName
(),
));
}
}
Event Timeline
Log In to Comment