Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F69996620
AphrontView.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
Thu, Jul 4, 18:10
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jul 6, 18:10 (2 d)
Engine
blob
Format
Raw Data
Handle
18776696
Attached To
rPH Phabricator
AphrontView.php
View Options
<?php
abstract
class
AphrontView
extends
Phobject
{
protected
$user
;
protected
$children
=
array
();
public
function
setUser
(
PhabricatorUser
$user
)
{
$this
->
user
=
$user
;
return
$this
;
}
protected
function
getUser
()
{
return
$this
->
user
;
}
protected
function
canAppendChild
()
{
return
true
;
}
final
public
function
appendChild
(
$child
)
{
if
(!
$this
->
canAppendChild
())
{
$class
=
get_class
(
$this
);
throw
new
Exception
(
"View '{$class}' does not support children."
);
}
$this
->
children
[]
=
$child
;
return
$this
;
}
final
protected
function
renderChildren
()
{
$out
=
array
();
foreach
(
$this
->
children
as
$child
)
{
$out
[]
=
$this
->
renderSingleView
(
$child
);
}
return
implode
(
''
,
$out
);
}
final
protected
function
renderSingleView
(
$child
)
{
if
(
$child
instanceof
AphrontView
)
{
return
$child
->
render
();
}
else
if
(
is_array
(
$child
))
{
$out
=
array
();
foreach
(
$child
as
$element
)
{
$out
[]
=
$this
->
renderSingleView
(
$element
);
}
return
implode
(
''
,
$out
);
}
else
{
return
$child
;
}
}
abstract
public
function
render
();
}
Event Timeline
Log In to Comment