Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F112074061
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
Wed, May 7, 12:09
Size
1 KB
Mime Type
text/x-php
Expires
Fri, May 9, 12:09 (2 d)
Engine
blob
Format
Raw Data
Handle
26026190
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
;
}
protected
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