1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +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:
vrana 2013-02-11 14:55:35 -08:00
parent ae4e5807d6
commit 8c71815028
31 changed files with 29 additions and 45 deletions

View file

@ -101,7 +101,7 @@ final class DifferentialChangesetDetailView extends AphrontView {
$buttons,
phutil_tag('h1', array(), $display_filename),
phutil_tag('div', array('style' => 'clear: both'), ''),
$this->renderHTMLChildren(),
$this->renderChildren(),
)));
}

View file

@ -123,7 +123,7 @@ final class DifferentialInlineCommentEditView extends AphrontView {
array(
'class' => 'differential-inline-comment-edit-body',
),
$this->renderHTMLChildren());
$this->renderChildren());
$edit = phutil_tag(
'edit',

View file

@ -17,7 +17,7 @@ final class DifferentialPrimaryPaneView extends AphrontView {
'class' => 'differential-primary-pane',
'id' => $this->id,
),
$this->renderHTMLChildren());
$this->renderChildren());
}
}

View file

@ -89,7 +89,7 @@ final class PhabricatorFeedStoryView extends PhabricatorFeedView {
array(
'class' => 'phabricator-feed-story-body',
),
phutil_safe_html($this->renderChildren()));
phutil_safe_html(implode('', $this->renderChildren())));
if ($this->epoch) {
$foot = phabricator_datetime($this->epoch, $this->user);

View file

@ -85,7 +85,7 @@ final class PonderVotableView extends AphrontView {
array(
'class' => 'ponder-votebox-content',
),
$this->renderHTMLChildren()),
$this->renderChildren()),
));
}

View file

@ -8,7 +8,7 @@ final class JavelinViewExampleServerView extends AphrontView {
array(
'class' => 'server-view',
),
$this->renderHTMLChildren());
$this->renderChildren());
}
}

View file

@ -124,14 +124,6 @@ return `phutil_tag()` or `javelin_tag()`:
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() =
The @{function:pht} function has some special rules. If any input to

View file

@ -158,7 +158,7 @@ final class AphrontDialogView extends AphrontView {
}
$buttons[] = phutil_tag('div', array('style' => 'clear: both;'), '');
$children = $this->renderHTMLChildren();
$children = $this->renderChildren();
$content = hsprintf(
'%s%s%s',

View file

@ -32,7 +32,7 @@ final class AphrontJavelinView extends AphrontView {
'id' => $id,
'view' => $this->getName(),
'params' => $this->getParameters(),
'children' => $this->renderChildren(),
'children' => implode('', $this->renderChildren()),
'trigger_id' => $render_context,
));

View file

@ -3,7 +3,7 @@
final class AphrontNullView extends AphrontView {
public function render() {
return $this->renderHTMLChildren();
return phutil_implode_html('', $this->renderChildren());
}
}

View file

@ -87,7 +87,7 @@ abstract class AphrontTagView extends AphrontView {
}
protected function getTagContent() {
return $this->renderHTMLChildren();
return $this->renderChildren();
}
protected function willRender() {

View file

@ -29,14 +29,6 @@ abstract class AphrontView extends Phobject {
}
final protected function renderChildren() {
$out = array();
foreach ($this->children as $child) {
$out[] = $this->renderSingleView($child);
}
return implode('', $out);
}
final protected function renderHTMLChildren() {
$out = array();
foreach ($this->children as $child) {
$out[] = $this->renderSingleView($child);

View file

@ -92,7 +92,7 @@ final class AphrontErrorView extends AphrontView {
$classes[] = 'aphront-error-severity-'.$this->severity;
$classes = implode(' ', $classes);
$children = $this->renderHTMLChildren();
$children = $this->renderChildren();
$children[] = $list;
return phutil_tag(

View file

@ -102,7 +102,7 @@ final class AphrontFormInsetView extends AphrontView {
$content[] = $this->content;
}
$content = array_merge($content, $this->renderHTMLChildren());
$content = array_merge($content, $this->renderChildren());
return phutil_tag('div', $div_attributes, $content);
}

View file

@ -38,6 +38,6 @@ final class AphrontFormLayoutView extends AphrontView {
array(
'class' => $classes,
),
$this->renderHTMLChildren());
$this->renderChildren());
}
}

View file

@ -68,7 +68,7 @@ final class AphrontFormView extends AphrontView {
$layout
->appendChild($this->renderDataInputs())
->appendChild($this->renderHTMLChildren());
->appendChild($this->renderChildren());
if (!$this->user) {
throw new Exception('You must pass the user to AphrontFormView.');

View file

@ -24,7 +24,7 @@ final class AphrontContextBarView extends AphrontView {
'<div style="clear: both;"></div>'.
'</div>',
$view->render(),
$this->renderHTMLChildren());
$this->renderChildren());
}
}

View file

@ -10,7 +10,7 @@ final class AphrontListFilterView extends AphrontView {
'<td class="aphront-list-filter-view-controls">%s</td>'.
'</tr>'.
'</table>',
$this->renderHTMLChildren());
$this->renderChildren());
}
}

View file

@ -5,7 +5,7 @@ final class AphrontMiniPanelView extends AphrontView {
public function render() {
return hsprintf(
'<div class="aphront-mini-panel-view">%s</div>',
$this->renderHTMLChildren());
$this->renderChildren());
}
}

View file

@ -88,7 +88,7 @@ final class AphrontPanelView extends AphrontView {
'<div class="aphront-panel-header">'.
$buttons.$header.$caption.
'</div>';
$table = $this->renderChildren();
$table = implode('', $this->renderChildren());
require_celerity_resource('aphront-panel-view-css');

View file

@ -294,7 +294,7 @@ final class AphrontSideNavFilterView extends AphrontView {
),
array(
$crumbs,
phutil_safe_html($this->renderChildren()),
phutil_safe_html(implode('', $this->renderChildren())),
))
));
}

View file

@ -119,7 +119,7 @@ final class PhabricatorMenuItemView extends AphrontTagView {
return $this->renderSingleView(
array(
$this->renderHTMLChildren(),
$this->renderChildren(),
$name,
));
}

View file

@ -170,7 +170,7 @@ final class PhabricatorObjectItemView extends AphrontView {
array(
$header,
$attrs,
$this->renderHTMLChildren(),
$this->renderChildren(),
)));
return phutil_tag(

View file

@ -55,7 +55,7 @@ final class PhabricatorPinboardItemView extends AphrontView {
'height' => $this->imageHeight,
)));
$content = $this->renderHTMLChildren();
$content = $this->renderChildren();
if ($content) {
$content = phutil_tag(
'div',

View file

@ -70,6 +70,6 @@ final class PhabricatorProfileHeaderView extends AphrontView {
self::renderSingleView($this->profileActions),
$image,
$description).
$this->renderHTMLChildren();
$this->renderChildren();
}
}

View file

@ -100,7 +100,7 @@ final class PhabricatorTimelineEventView extends AphrontView {
}
public function render() {
$content = $this->renderHTMLChildren();
$content = $this->renderChildren();
$title = $this->title;
if (($title === null) && $this->isEmptyContent($content)) {

View file

@ -142,7 +142,7 @@ final class PhabricatorTransactionView extends AphrontView {
}
return
'<div class="phabricator-transaction-content">'.
$content.
implode('', $content).
'</div>';
}

View file

@ -22,7 +22,7 @@ abstract class AphrontPageView extends AphrontView {
}
protected function getBody() {
return $this->renderChildren();
return implode('', $this->renderChildren());
}
protected function getTail() {

View file

@ -21,7 +21,7 @@ final class AphrontRequestFailureView extends AphrontView {
'<div class="aphront-request-failure-body">%s</div>'.
'</div>',
$this->header,
$this->renderHTMLChildren());
$this->renderChildren());
}
}

View file

@ -55,7 +55,7 @@ class PhabricatorBarePageView extends AphrontPageView {
protected function willRenderPage() {
// We render this now to resolve static resources so they can appear in the
// document head.
$this->bodyContent = $this->renderChildren();
$this->bodyContent = implode('', $this->renderChildren());
}
protected function getHead() {

View file

@ -33,7 +33,7 @@ final class PhabricatorMainMenuGroupView extends AphrontView {
array(
'class' => implode(' ', $classes),
),
$this->renderHTMLChildren());
$this->renderChildren());
}
}