Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1062395
PhabricatorDashboardPanelTabsCustomField.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
PhabricatorDashboardPanelTabsCustomField.php
View Options
<?php
final
class
PhabricatorDashboardPanelTabsCustomField
extends
PhabricatorStandardCustomField
{
public
function
getFieldType
()
{
return
'dashboard.tabs'
;
}
public
function
shouldAppearInApplicationSearch
()
{
return
false
;
}
public
function
readValueFromRequest
(
AphrontRequest
$request
)
{
$value
=
array
();
$names
=
$request
->
getArr
(
$this
->
getFieldKey
().
'_name'
);
$panel_ids
=
$request
->
getArr
(
$this
->
getFieldKey
().
'_panelID'
);
$panels
=
array
();
foreach
(
$panel_ids
as
$panel_id
)
{
$panels
[]
=
$panel_id
[
0
];
}
foreach
(
$names
as
$idx
=>
$name
)
{
$panel_id
=
idx
(
$panels
,
$idx
);
if
(
strlen
(
$name
)
&&
$panel_id
)
{
$value
[]
=
array
(
'name'
=>
$name
,
'panelID'
=>
$panel_id
,
);
}
}
$this
->
setFieldValue
(
$value
);
}
public
function
renderEditControl
(
array
$handles
)
{
// NOTE: This includes archived panels so we don't mutate the tabs
// when saving a tab panel that includes archied panels. This whole UI is
// hopefully temporary anyway.
$value
=
$this
->
getFieldValue
();
if
(!
is_array
(
$value
))
{
$value
=
array
();
}
$out
=
array
();
for
(
$ii
=
1
;
$ii
<=
6
;
$ii
++)
{
$tab
=
idx
(
$value
,
(
$ii
-
1
),
array
());
$panel
=
idx
(
$tab
,
'panelID'
,
null
);
$panel_id
=
array
();
if
(
$panel
)
{
$panel_id
[]
=
$panel
;
}
$out
[]
=
id
(
new
AphrontFormTextControl
())
->
setName
(
$this
->
getFieldKey
().
'_name[]'
)
->
setValue
(
idx
(
$tab
,
'name'
))
->
setLabel
(
pht
(
'Tab %d Name'
,
$ii
));
$out
[]
=
id
(
new
AphrontFormTokenizerControl
())
->
setUser
(
$this
->
getViewer
())
->
setDatasource
(
new
PhabricatorDashboardPanelDatasource
())
->
setName
(
$this
->
getFieldKey
().
'_panelID[]'
)
->
setValue
(
$panel_id
)
->
setLimit
(
1
)
->
setLabel
(
pht
(
'Tab %d Panel'
,
$ii
));
}
return
$out
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jun 29, 9:53 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
258926
Default Alt Text
PhabricatorDashboardPanelTabsCustomField.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment