[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/view/ -> AphrontJavelinView.php (source)

   1  <?php
   2  
   3  final class AphrontJavelinView extends AphrontView {
   4    private static $renderContext = array();
   5    private static function peekRenderContext() {
   6      return nonempty(end(self::$renderContext), null);
   7    }
   8  
   9    private static function popRenderContext() {
  10      return array_pop(self::$renderContext);
  11    }
  12  
  13    private static function pushRenderContext($token) {
  14      self::$renderContext[] = $token;
  15    }
  16  
  17  
  18    private $name;
  19    private $parameters;
  20    private $celerityResource;
  21  
  22    public function render() {
  23      $id = celerity_generate_unique_node_id();
  24      $placeholder = phutil_tag('span', array('id' => $id));
  25  
  26      require_celerity_resource($this->getCelerityResource());
  27  
  28      $render_context = self::peekRenderContext();
  29      self::pushRenderContext($id);
  30  
  31      Javelin::initBehavior('view-placeholder', array(
  32        'id' => $id,
  33        'view' => $this->getName(),
  34        'params' => $this->getParameters(),
  35        'children' => phutil_implode_html('', $this->renderChildren()),
  36        'trigger_id' => $render_context,
  37      ));
  38  
  39      self::popRenderContext();
  40  
  41      return $placeholder;
  42    }
  43  
  44  
  45    protected function getName() {
  46      return $this->name;
  47    }
  48  
  49    final public function setName($template_name) {
  50      $this->name = $template_name;
  51      return $this;
  52    }
  53  
  54    protected function getParameters() {
  55      return $this->parameters;
  56    }
  57  
  58    final public function setParameters($template_parameters) {
  59      $this->parameters = $template_parameters;
  60      return $this;
  61    }
  62  
  63    protected function getCelerityResource() {
  64      return $this->celerityResource;
  65    }
  66  
  67    final public function setCelerityResource($celerity_resource) {
  68      $this->celerityResource = $celerity_resource;
  69      return $this;
  70    }
  71  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1