This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
Sequenzia/lib/Rails/ActionController/Response/Partial.php

44 lines
1.3 KiB
PHP
Raw Normal View History

2013-10-02 18:14:53 +02:00
<?php
namespace Rails\ActionController\Response;
use Rails\ActionView;
# TODO
2013-10-13 09:50:03 +02:00
class Partial extends Base
2013-10-02 18:14:53 +02:00
{
2013-10-13 09:50:03 +02:00
private $_template;
2013-10-02 18:14:53 +02:00
public function _render_view()
{
# Include helpers.
ActionView\ViewHelpers::load();
2013-10-13 09:50:03 +02:00
$layout = !empty($this->_params['layout']) ? $this->_params['layout'] : false;
$partial = $this->_params['partial'];
$locals = (array)\Rails::application()->controller()->locals();
$this->_template = new ActionView\Template(['lambda' => function() use ($partial, $locals) {
echo $this->partial($partial, $locals);
}], ['layout' => $layout]);
// $this->_template->setLocals();
$this->_template->renderContent();
// $params = [$this->_params['partial']];
// if (isset($this->_params['locals']))
// $params = array_merge($params, [$this->_params['locals']]);
# Include helpers.
// ActionView\ViewHelpers::load();
2013-10-02 18:14:53 +02:00
# Create a template so we can call render_partial.
# This shouldn't be done this way.
2013-10-13 09:50:03 +02:00
// $template = new ActionView\Template([]);
// vpe($this);
// $this->_body = call_user_func_array([$template, 'renderContent'], $params);
2013-10-02 18:14:53 +02:00
}
public function _print_view()
{
2013-10-13 09:50:03 +02:00
return $this->_template->content();
2013-10-02 18:14:53 +02:00
}
2013-10-13 09:50:03 +02:00
}