Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93586770
AphrontFormChooseButtonControl.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, Nov 29, 23:14
Size
2 KB
Mime Type
text/x-php
Expires
Sun, Dec 1, 23:14 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22671018
Attached To
rPH Phabricator
AphrontFormChooseButtonControl.php
View Options
<?php
final
class
AphrontFormChooseButtonControl
extends
AphrontFormControl
{
private
$displayValue
;
private
$buttonText
;
private
$chooseURI
;
public
function
setDisplayValue
(
$display_value
)
{
$this
->
displayValue
=
$display_value
;
return
$this
;
}
public
function
getDisplayValue
()
{
return
$this
->
displayValue
;
}
public
function
setButtonText
(
$text
)
{
$this
->
buttonText
=
$text
;
return
$this
;
}
public
function
setChooseURI
(
$choose_uri
)
{
$this
->
chooseURI
=
$choose_uri
;
return
$this
;
}
protected
function
getCustomControlClass
()
{
return
'aphront-form-control-choose-button'
;
}
protected
function
renderInput
()
{
Javelin
::
initBehavior
(
'choose-control'
);
$input_id
=
celerity_generate_unique_node_id
();
$display_id
=
celerity_generate_unique_node_id
();
$display_value
=
$this
->
displayValue
;
$button
=
javelin_tag
(
'a'
,
array
(
'href'
=>
'#'
,
'class'
=>
'button grey'
,
'sigil'
=>
'aphront-form-choose-button'
,
),
nonempty
(
$this
->
buttonText
,
pht
(
'Choose...'
)));
$display_cell
=
phutil_tag
(
'td'
,
array
(
'class'
=>
'aphront-form-choose-display-cell'
,
'id'
=>
$display_id
,
),
$display_value
);
$button_cell
=
phutil_tag
(
'td'
,
array
(
'class'
=>
'aphront-form-choose-button-cell'
,
),
$button
);
$row
=
phutil_tag
(
'tr'
,
array
(),
array
(
$display_cell
,
$button_cell
));
$layout
=
javelin_tag
(
'table'
,
array
(
'class'
=>
'aphront-form-choose-table'
,
'sigil'
=>
'aphront-form-choose'
,
'meta'
=>
array
(
'uri'
=>
$this
->
chooseURI
,
'inputID'
=>
$input_id
,
'displayID'
=>
$display_id
,
),
),
$row
);
$hidden_input
=
phutil_tag
(
'input'
,
array
(
'type'
=>
'hidden'
,
'name'
=>
$this
->
getName
(),
'value'
=>
$this
->
getValue
(),
'id'
=>
$input_id
,
));
return
array
(
$hidden_input
,
$layout
,
);
}
}
Event Timeline
Log In to Comment