3 final class AphrontJavelinView
extends AphrontView
{
4 private static $renderContext = array();
5 private static function peekRenderContext() {
6 return nonempty(end(self
::$renderContext), null);
9 private static function popRenderContext() {
10 return array_pop(self
::$renderContext);
13 private static function pushRenderContext($token) {
14 self
::$renderContext[] = $token;
20 private $celerityResource;
22 public function render() {
23 $id = celerity_generate_unique_node_id();
24 $placeholder = phutil_tag('span', array('id' => $id));
26 require_celerity_resource($this->getCelerityResource());
28 $render_context = self
::peekRenderContext();
29 self
::pushRenderContext($id);
31 Javelin
::initBehavior('view-placeholder', array(
33 'view' => $this->getName(),
34 'params' => $this->getParameters(),
35 'children' => phutil_implode_html('', $this->renderChildren()),
36 'trigger_id' => $render_context,
39 self
::popRenderContext();
45 protected function getName() {
49 public function setName($template_name) {
50 $this->name
= $template_name;
54 protected function getParameters() {
55 return $this->parameters
;
58 public function setParameters($template_parameters) {
59 $this->parameters
= $template_parameters;
63 protected function getCelerityResource() {
64 return $this->celerityResource
;
67 public function setCelerityResource($celerity_resource) {
68 $this->celerityResource
= $celerity_resource;