mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 07:12:41 +01:00
Merge renderChildren() and renderHTMLChildren()
Summary: `renderChildren()` now returns array which isn't ideal but I prefer it to having two methods. Test Plan: None. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4910
This commit is contained in:
parent
ae4e5807d6
commit
8c71815028
31 changed files with 29 additions and 45 deletions
|
@ -101,7 +101,7 @@ final class DifferentialChangesetDetailView extends AphrontView {
|
||||||
$buttons,
|
$buttons,
|
||||||
phutil_tag('h1', array(), $display_filename),
|
phutil_tag('h1', array(), $display_filename),
|
||||||
phutil_tag('div', array('style' => 'clear: both'), ''),
|
phutil_tag('div', array('style' => 'clear: both'), ''),
|
||||||
$this->renderHTMLChildren(),
|
$this->renderChildren(),
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ final class DifferentialInlineCommentEditView extends AphrontView {
|
||||||
array(
|
array(
|
||||||
'class' => 'differential-inline-comment-edit-body',
|
'class' => 'differential-inline-comment-edit-body',
|
||||||
),
|
),
|
||||||
$this->renderHTMLChildren());
|
$this->renderChildren());
|
||||||
|
|
||||||
$edit = phutil_tag(
|
$edit = phutil_tag(
|
||||||
'edit',
|
'edit',
|
||||||
|
|
|
@ -17,7 +17,7 @@ final class DifferentialPrimaryPaneView extends AphrontView {
|
||||||
'class' => 'differential-primary-pane',
|
'class' => 'differential-primary-pane',
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
),
|
),
|
||||||
$this->renderHTMLChildren());
|
$this->renderChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ final class PhabricatorFeedStoryView extends PhabricatorFeedView {
|
||||||
array(
|
array(
|
||||||
'class' => 'phabricator-feed-story-body',
|
'class' => 'phabricator-feed-story-body',
|
||||||
),
|
),
|
||||||
phutil_safe_html($this->renderChildren()));
|
phutil_safe_html(implode('', $this->renderChildren())));
|
||||||
|
|
||||||
if ($this->epoch) {
|
if ($this->epoch) {
|
||||||
$foot = phabricator_datetime($this->epoch, $this->user);
|
$foot = phabricator_datetime($this->epoch, $this->user);
|
||||||
|
|
|
@ -85,7 +85,7 @@ final class PonderVotableView extends AphrontView {
|
||||||
array(
|
array(
|
||||||
'class' => 'ponder-votebox-content',
|
'class' => 'ponder-votebox-content',
|
||||||
),
|
),
|
||||||
$this->renderHTMLChildren()),
|
$this->renderChildren()),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ final class JavelinViewExampleServerView extends AphrontView {
|
||||||
array(
|
array(
|
||||||
'class' => 'server-view',
|
'class' => 'server-view',
|
||||||
),
|
),
|
||||||
$this->renderHTMLChildren());
|
$this->renderChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,14 +124,6 @@ return `phutil_tag()` or `javelin_tag()`:
|
||||||
|
|
||||||
return phutil_tag('div', ...);
|
return phutil_tag('div', ...);
|
||||||
|
|
||||||
@{class:AphrontView} subclasses can use `renderHTMLChildren()` and
|
|
||||||
`renderSingleView()` to build @{class@libphutil:PhutilSafeHTML} objects from
|
|
||||||
children or arbitrary lists of components.
|
|
||||||
|
|
||||||
@{class:AphrontView} subclasses should avoid `renderChildren()` and transition
|
|
||||||
callers to `renderHTMLChildren()`. This older method does not return
|
|
||||||
@{class@libphutil:PhutilSafeHTML} objects.
|
|
||||||
|
|
||||||
= Internationalization: pht() =
|
= Internationalization: pht() =
|
||||||
|
|
||||||
The @{function:pht} function has some special rules. If any input to
|
The @{function:pht} function has some special rules. If any input to
|
||||||
|
|
|
@ -158,7 +158,7 @@ final class AphrontDialogView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
$buttons[] = phutil_tag('div', array('style' => 'clear: both;'), '');
|
$buttons[] = phutil_tag('div', array('style' => 'clear: both;'), '');
|
||||||
$children = $this->renderHTMLChildren();
|
$children = $this->renderChildren();
|
||||||
|
|
||||||
$content = hsprintf(
|
$content = hsprintf(
|
||||||
'%s%s%s',
|
'%s%s%s',
|
||||||
|
|
|
@ -32,7 +32,7 @@ final class AphrontJavelinView extends AphrontView {
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'view' => $this->getName(),
|
'view' => $this->getName(),
|
||||||
'params' => $this->getParameters(),
|
'params' => $this->getParameters(),
|
||||||
'children' => $this->renderChildren(),
|
'children' => implode('', $this->renderChildren()),
|
||||||
'trigger_id' => $render_context,
|
'trigger_id' => $render_context,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
final class AphrontNullView extends AphrontView {
|
final class AphrontNullView extends AphrontView {
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
return $this->renderHTMLChildren();
|
return phutil_implode_html('', $this->renderChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ abstract class AphrontTagView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTagContent() {
|
protected function getTagContent() {
|
||||||
return $this->renderHTMLChildren();
|
return $this->renderChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function willRender() {
|
protected function willRender() {
|
||||||
|
|
|
@ -29,14 +29,6 @@ abstract class AphrontView extends Phobject {
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected function renderChildren() {
|
final protected function renderChildren() {
|
||||||
$out = array();
|
|
||||||
foreach ($this->children as $child) {
|
|
||||||
$out[] = $this->renderSingleView($child);
|
|
||||||
}
|
|
||||||
return implode('', $out);
|
|
||||||
}
|
|
||||||
|
|
||||||
final protected function renderHTMLChildren() {
|
|
||||||
$out = array();
|
$out = array();
|
||||||
foreach ($this->children as $child) {
|
foreach ($this->children as $child) {
|
||||||
$out[] = $this->renderSingleView($child);
|
$out[] = $this->renderSingleView($child);
|
||||||
|
|
|
@ -92,7 +92,7 @@ final class AphrontErrorView extends AphrontView {
|
||||||
$classes[] = 'aphront-error-severity-'.$this->severity;
|
$classes[] = 'aphront-error-severity-'.$this->severity;
|
||||||
$classes = implode(' ', $classes);
|
$classes = implode(' ', $classes);
|
||||||
|
|
||||||
$children = $this->renderHTMLChildren();
|
$children = $this->renderChildren();
|
||||||
$children[] = $list;
|
$children[] = $list;
|
||||||
|
|
||||||
return phutil_tag(
|
return phutil_tag(
|
||||||
|
|
|
@ -102,7 +102,7 @@ final class AphrontFormInsetView extends AphrontView {
|
||||||
$content[] = $this->content;
|
$content[] = $this->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = array_merge($content, $this->renderHTMLChildren());
|
$content = array_merge($content, $this->renderChildren());
|
||||||
|
|
||||||
return phutil_tag('div', $div_attributes, $content);
|
return phutil_tag('div', $div_attributes, $content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,6 @@ final class AphrontFormLayoutView extends AphrontView {
|
||||||
array(
|
array(
|
||||||
'class' => $classes,
|
'class' => $classes,
|
||||||
),
|
),
|
||||||
$this->renderHTMLChildren());
|
$this->renderChildren());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ final class AphrontFormView extends AphrontView {
|
||||||
|
|
||||||
$layout
|
$layout
|
||||||
->appendChild($this->renderDataInputs())
|
->appendChild($this->renderDataInputs())
|
||||||
->appendChild($this->renderHTMLChildren());
|
->appendChild($this->renderChildren());
|
||||||
|
|
||||||
if (!$this->user) {
|
if (!$this->user) {
|
||||||
throw new Exception('You must pass the user to AphrontFormView.');
|
throw new Exception('You must pass the user to AphrontFormView.');
|
||||||
|
|
|
@ -24,7 +24,7 @@ final class AphrontContextBarView extends AphrontView {
|
||||||
'<div style="clear: both;"></div>'.
|
'<div style="clear: both;"></div>'.
|
||||||
'</div>',
|
'</div>',
|
||||||
$view->render(),
|
$view->render(),
|
||||||
$this->renderHTMLChildren());
|
$this->renderChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ final class AphrontListFilterView extends AphrontView {
|
||||||
'<td class="aphront-list-filter-view-controls">%s</td>'.
|
'<td class="aphront-list-filter-view-controls">%s</td>'.
|
||||||
'</tr>'.
|
'</tr>'.
|
||||||
'</table>',
|
'</table>',
|
||||||
$this->renderHTMLChildren());
|
$this->renderChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ final class AphrontMiniPanelView extends AphrontView {
|
||||||
public function render() {
|
public function render() {
|
||||||
return hsprintf(
|
return hsprintf(
|
||||||
'<div class="aphront-mini-panel-view">%s</div>',
|
'<div class="aphront-mini-panel-view">%s</div>',
|
||||||
$this->renderHTMLChildren());
|
$this->renderChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ final class AphrontPanelView extends AphrontView {
|
||||||
'<div class="aphront-panel-header">'.
|
'<div class="aphront-panel-header">'.
|
||||||
$buttons.$header.$caption.
|
$buttons.$header.$caption.
|
||||||
'</div>';
|
'</div>';
|
||||||
$table = $this->renderChildren();
|
$table = implode('', $this->renderChildren());
|
||||||
|
|
||||||
require_celerity_resource('aphront-panel-view-css');
|
require_celerity_resource('aphront-panel-view-css');
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ final class AphrontSideNavFilterView extends AphrontView {
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
$crumbs,
|
$crumbs,
|
||||||
phutil_safe_html($this->renderChildren()),
|
phutil_safe_html(implode('', $this->renderChildren())),
|
||||||
))
|
))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ final class PhabricatorMenuItemView extends AphrontTagView {
|
||||||
|
|
||||||
return $this->renderSingleView(
|
return $this->renderSingleView(
|
||||||
array(
|
array(
|
||||||
$this->renderHTMLChildren(),
|
$this->renderChildren(),
|
||||||
$name,
|
$name,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ final class PhabricatorObjectItemView extends AphrontView {
|
||||||
array(
|
array(
|
||||||
$header,
|
$header,
|
||||||
$attrs,
|
$attrs,
|
||||||
$this->renderHTMLChildren(),
|
$this->renderChildren(),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
return phutil_tag(
|
return phutil_tag(
|
||||||
|
|
|
@ -55,7 +55,7 @@ final class PhabricatorPinboardItemView extends AphrontView {
|
||||||
'height' => $this->imageHeight,
|
'height' => $this->imageHeight,
|
||||||
)));
|
)));
|
||||||
|
|
||||||
$content = $this->renderHTMLChildren();
|
$content = $this->renderChildren();
|
||||||
if ($content) {
|
if ($content) {
|
||||||
$content = phutil_tag(
|
$content = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
|
|
|
@ -70,6 +70,6 @@ final class PhabricatorProfileHeaderView extends AphrontView {
|
||||||
self::renderSingleView($this->profileActions),
|
self::renderSingleView($this->profileActions),
|
||||||
$image,
|
$image,
|
||||||
$description).
|
$description).
|
||||||
$this->renderHTMLChildren();
|
$this->renderChildren();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ final class PhabricatorTimelineEventView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
$content = $this->renderHTMLChildren();
|
$content = $this->renderChildren();
|
||||||
|
|
||||||
$title = $this->title;
|
$title = $this->title;
|
||||||
if (($title === null) && $this->isEmptyContent($content)) {
|
if (($title === null) && $this->isEmptyContent($content)) {
|
||||||
|
|
|
@ -142,7 +142,7 @@ final class PhabricatorTransactionView extends AphrontView {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
'<div class="phabricator-transaction-content">'.
|
'<div class="phabricator-transaction-content">'.
|
||||||
$content.
|
implode('', $content).
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ abstract class AphrontPageView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getBody() {
|
protected function getBody() {
|
||||||
return $this->renderChildren();
|
return implode('', $this->renderChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTail() {
|
protected function getTail() {
|
||||||
|
|
|
@ -21,7 +21,7 @@ final class AphrontRequestFailureView extends AphrontView {
|
||||||
'<div class="aphront-request-failure-body">%s</div>'.
|
'<div class="aphront-request-failure-body">%s</div>'.
|
||||||
'</div>',
|
'</div>',
|
||||||
$this->header,
|
$this->header,
|
||||||
$this->renderHTMLChildren());
|
$this->renderChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ class PhabricatorBarePageView extends AphrontPageView {
|
||||||
protected function willRenderPage() {
|
protected function willRenderPage() {
|
||||||
// We render this now to resolve static resources so they can appear in the
|
// We render this now to resolve static resources so they can appear in the
|
||||||
// document head.
|
// document head.
|
||||||
$this->bodyContent = $this->renderChildren();
|
$this->bodyContent = implode('', $this->renderChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getHead() {
|
protected function getHead() {
|
||||||
|
|
|
@ -33,7 +33,7 @@ final class PhabricatorMainMenuGroupView extends AphrontView {
|
||||||
array(
|
array(
|
||||||
'class' => implode(' ', $classes),
|
'class' => implode(' ', $classes),
|
||||||
),
|
),
|
||||||
$this->renderHTMLChildren());
|
$this->renderChildren());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue