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:
parent
ae4e5807d6
commit
8c71815028
31 changed files with 29 additions and 45 deletions
|
@ -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(),
|
||||
)));
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ final class DifferentialInlineCommentEditView extends AphrontView {
|
|||
array(
|
||||
'class' => 'differential-inline-comment-edit-body',
|
||||
),
|
||||
$this->renderHTMLChildren());
|
||||
$this->renderChildren());
|
||||
|
||||
$edit = phutil_tag(
|
||||
'edit',
|
||||
|
|
|
@ -17,7 +17,7 @@ final class DifferentialPrimaryPaneView extends AphrontView {
|
|||
'class' => 'differential-primary-pane',
|
||||
'id' => $this->id,
|
||||
),
|
||||
$this->renderHTMLChildren());
|
||||
$this->renderChildren());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -85,7 +85,7 @@ final class PonderVotableView extends AphrontView {
|
|||
array(
|
||||
'class' => 'ponder-votebox-content',
|
||||
),
|
||||
$this->renderHTMLChildren()),
|
||||
$this->renderChildren()),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ final class JavelinViewExampleServerView extends AphrontView {
|
|||
array(
|
||||
'class' => 'server-view',
|
||||
),
|
||||
$this->renderHTMLChildren());
|
||||
$this->renderChildren());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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,
|
||||
));
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
final class AphrontNullView extends AphrontView {
|
||||
|
||||
public function render() {
|
||||
return $this->renderHTMLChildren();
|
||||
return phutil_implode_html('', $this->renderChildren());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ abstract class AphrontTagView extends AphrontView {
|
|||
}
|
||||
|
||||
protected function getTagContent() {
|
||||
return $this->renderHTMLChildren();
|
||||
return $this->renderChildren();
|
||||
}
|
||||
|
||||
protected function willRender() {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,6 @@ final class AphrontFormLayoutView extends AphrontView {
|
|||
array(
|
||||
'class' => $classes,
|
||||
),
|
||||
$this->renderHTMLChildren());
|
||||
$this->renderChildren());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.');
|
||||
|
|
|
@ -24,7 +24,7 @@ final class AphrontContextBarView extends AphrontView {
|
|||
'<div style="clear: both;"></div>'.
|
||||
'</div>',
|
||||
$view->render(),
|
||||
$this->renderHTMLChildren());
|
||||
$this->renderChildren());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ final class AphrontListFilterView extends AphrontView {
|
|||
'<td class="aphront-list-filter-view-controls">%s</td>'.
|
||||
'</tr>'.
|
||||
'</table>',
|
||||
$this->renderHTMLChildren());
|
||||
$this->renderChildren());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ final class AphrontSideNavFilterView extends AphrontView {
|
|||
),
|
||||
array(
|
||||
$crumbs,
|
||||
phutil_safe_html($this->renderChildren()),
|
||||
phutil_safe_html(implode('', $this->renderChildren())),
|
||||
))
|
||||
));
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ final class PhabricatorMenuItemView extends AphrontTagView {
|
|||
|
||||
return $this->renderSingleView(
|
||||
array(
|
||||
$this->renderHTMLChildren(),
|
||||
$this->renderChildren(),
|
||||
$name,
|
||||
));
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ final class PhabricatorObjectItemView extends AphrontView {
|
|||
array(
|
||||
$header,
|
||||
$attrs,
|
||||
$this->renderHTMLChildren(),
|
||||
$this->renderChildren(),
|
||||
)));
|
||||
|
||||
return phutil_tag(
|
||||
|
|
|
@ -55,7 +55,7 @@ final class PhabricatorPinboardItemView extends AphrontView {
|
|||
'height' => $this->imageHeight,
|
||||
)));
|
||||
|
||||
$content = $this->renderHTMLChildren();
|
||||
$content = $this->renderChildren();
|
||||
if ($content) {
|
||||
$content = phutil_tag(
|
||||
'div',
|
||||
|
|
|
@ -70,6 +70,6 @@ final class PhabricatorProfileHeaderView extends AphrontView {
|
|||
self::renderSingleView($this->profileActions),
|
||||
$image,
|
||||
$description).
|
||||
$this->renderHTMLChildren();
|
||||
$this->renderChildren();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -142,7 +142,7 @@ final class PhabricatorTransactionView extends AphrontView {
|
|||
}
|
||||
return
|
||||
'<div class="phabricator-transaction-content">'.
|
||||
$content.
|
||||
implode('', $content).
|
||||
'</div>';
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ abstract class AphrontPageView extends AphrontView {
|
|||
}
|
||||
|
||||
protected function getBody() {
|
||||
return $this->renderChildren();
|
||||
return implode('', $this->renderChildren());
|
||||
}
|
||||
|
||||
protected function getTail() {
|
||||
|
|
|
@ -21,7 +21,7 @@ final class AphrontRequestFailureView extends AphrontView {
|
|||
'<div class="aphront-request-failure-body">%s</div>'.
|
||||
'</div>',
|
||||
$this->header,
|
||||
$this->renderHTMLChildren());
|
||||
$this->renderChildren());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -33,7 +33,7 @@ final class PhabricatorMainMenuGroupView extends AphrontView {
|
|||
array(
|
||||
'class' => implode(' ', $classes),
|
||||
),
|
||||
$this->renderHTMLChildren());
|
||||
$this->renderChildren());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue