@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Have AphrontView implement PhutilSafeHTMLProducerInterface

Summary: Allows views to work like tags.

Test Plan: Implemented a few completely arbitrary render() / singleView simplifications. I just picked some that were easy to test. I'll do a more thorough pass on this in a followup; these calls don't really hurt anything.

Reviewers: chad, vrana

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D5306

+32 -22
+5 -1
src/__phutil_library_map__.php
··· 1652 1652 'AphrontTokenizerTemplateView' => 'AphrontView', 1653 1653 'AphrontTypeaheadTemplateView' => 'AphrontView', 1654 1654 'AphrontUsageException' => 'AphrontException', 1655 - 'AphrontView' => 'Phobject', 1655 + 'AphrontView' => 1656 + array( 1657 + 0 => 'Phobject', 1658 + 1 => 'PhutilSafeHTMLProducerInterface', 1659 + ), 1656 1660 'AphrontWebpageResponse' => 'AphrontHTMLResponse', 1657 1661 'AuditPeopleMenuEventListener' => 'PhutilEventListener', 1658 1662 'CelerityPhabricatorResourceController' => 'CelerityResourceController',
+1 -1
src/applications/calendar/controller/PhabricatorCalendarBrowseController.php
··· 54 54 $nav->appendChild( 55 55 array( 56 56 $this->getNoticeView(), 57 - hsprintf('<div style="padding: 20px;">%s</div>', $month_view->render()), 57 + hsprintf('<div style="padding: 20px;">%s</div>', $month_view), 58 58 )); 59 59 60 60 return $this->buildApplicationPage(
+14 -17
src/applications/differential/view/DifferentialInlineCommentEditView.php
··· 55 55 'method' => 'POST', 56 56 'sigil' => 'inline-edit-form', 57 57 ), 58 - $this->renderSingleView( 59 - array( 60 - $this->renderInputs(), 61 - $this->renderBody(), 62 - ))); 58 + array( 59 + $this->renderInputs(), 60 + $this->renderBody(), 61 + )); 63 62 64 63 return hsprintf( 65 64 '<table>'. ··· 130 129 array( 131 130 'class' => 'differential-inline-comment-edit-buttons', 132 131 ), 133 - $this->renderSingleView( 134 - array( 135 - $formatting, 136 - $buttons, 137 - phutil_tag('div', array('style' => 'clear: both'), ''), 138 - ))); 132 + array( 133 + $formatting, 134 + $buttons, 135 + phutil_tag('div', array('style' => 'clear: both'), ''), 136 + )); 139 137 140 138 return javelin_tag( 141 139 'div', ··· 148 146 'length' => $this->length, 149 147 ), 150 148 ), 151 - $this->renderSingleView( 152 - array( 153 - $title, 154 - $body, 155 - $edit, 156 - ))); 149 + array( 150 + $title, 151 + $body, 152 + $edit, 153 + )); 157 154 } 158 155 159 156 }
+5
src/docs/developer/rendering_html.diviner
··· 20 20 - Combine elements with arrays, not string concatenation. 21 21 - @{class:AphrontView} subclasses should return a 22 22 @{class@libphutil:PhutilSafeHTML} object from their `render()` method. 23 + - @{class:AphrontView} subclasses act like tags when rendering. 23 24 - @{function:pht} has some special rules. 24 25 - There are some other things that you should be aware of. 25 26 - Do not use @{function:phutil_render_tag} or @{function:javelin_render_tag}, ··· 123 124 return `phutil_tag()` or `javelin_tag()`: 124 125 125 126 return phutil_tag('div', ...); 127 + 128 + You can use an @{class:AphrontView} subclass like you would a tag: 129 + 130 + phutil_tag('div', array(), $view); 126 131 127 132 = Internationalization: pht() = 128 133
+6 -1
src/view/AphrontView.php
··· 1 1 <?php 2 2 3 - abstract class AphrontView extends Phobject { 3 + abstract class AphrontView extends Phobject 4 + implements PhutilSafeHTMLProducerInterface { 4 5 5 6 protected $user; 6 7 protected $children = array(); ··· 64 65 } 65 66 66 67 abstract public function render(); 68 + 69 + public function producePhutilSafeHTML() { 70 + return $this->render(); 71 + } 67 72 68 73 }
+1 -2
src/view/layout/PhabricatorPropertyListView.php
··· 145 145 146 146 $shortcuts = null; 147 147 if ($this->hasKeyboardShortcuts) { 148 - $shortcuts = 149 - id(new AphrontKeyboardShortcutsAvailableView())->render(); 148 + $shortcuts = new AphrontKeyboardShortcutsAvailableView(); 150 149 } 151 150 152 151 return array(