2010-02-17 13:55:05 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2011-01-15 13:29:43 +00:00
|
|
|
* This file is part of the Symfony package.
|
2010-02-17 13:55:05 +00:00
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
2010-02-17 13:55:05 +00:00
|
|
|
*
|
2011-01-15 13:29:43 +00:00
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
2010-02-17 13:55:05 +00:00
|
|
|
*/
|
|
|
|
|
2011-01-15 13:29:43 +00:00
|
|
|
namespace Symfony\Bundle\FrameworkBundle\Templating\Helper;
|
|
|
|
|
|
|
|
use Symfony\Component\Templating\Helper\Helper;
|
2012-12-19 07:54:53 +00:00
|
|
|
use Symfony\Component\HttpKernel\HttpContentRenderer;
|
|
|
|
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
2011-01-15 13:29:43 +00:00
|
|
|
|
2010-02-17 13:55:05 +00:00
|
|
|
/**
|
2010-09-27 13:48:21 +01:00
|
|
|
* ActionsHelper manages action inclusions.
|
2010-02-17 13:55:05 +00:00
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* @author Fabien Potencier <fabien@symfony.com>
|
2010-02-17 13:55:05 +00:00
|
|
|
*/
|
|
|
|
class ActionsHelper extends Helper
|
|
|
|
{
|
2012-12-19 07:54:53 +00:00
|
|
|
private $renderer;
|
2010-05-06 12:25:53 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*
|
2012-12-19 07:54:53 +00:00
|
|
|
* @param HttpContentRenderer $kernel A HttpContentRenderer instance
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2012-12-19 07:54:53 +00:00
|
|
|
public function __construct(HttpContentRenderer $renderer)
|
2010-05-06 12:25:53 +01:00
|
|
|
{
|
2012-12-19 07:54:53 +00:00
|
|
|
$this->renderer = $renderer;
|
2010-05-06 12:25:53 +01:00
|
|
|
}
|
|
|
|
|
2010-05-13 07:29:04 +01:00
|
|
|
/**
|
2012-12-20 21:44:30 +00:00
|
|
|
* Returns the Response content for a given URI.
|
2010-05-13 07:29:04 +01:00
|
|
|
*
|
2012-12-20 21:44:30 +00:00
|
|
|
* @param string $uri A URI
|
|
|
|
* @param array $options An array of options
|
2010-05-18 12:05:03 +01:00
|
|
|
*
|
2012-12-16 12:02:54 +00:00
|
|
|
* @return string
|
|
|
|
*
|
2012-12-19 07:54:53 +00:00
|
|
|
* @see Symfony\Component\HttpKernel\HttpContentRenderer::render()
|
2010-05-13 07:29:04 +01:00
|
|
|
*/
|
2012-12-20 21:44:30 +00:00
|
|
|
public function render($uri, array $options = array())
|
2010-05-06 12:25:53 +01:00
|
|
|
{
|
2012-12-19 07:54:53 +00:00
|
|
|
return $this->renderer->render($uri, $options);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function controller($controller, $attributes = array(), $query = array())
|
|
|
|
{
|
|
|
|
return new ControllerReference($controller, $attributes, $query);
|
2010-05-06 12:25:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the canonical name of this helper.
|
|
|
|
*
|
|
|
|
* @return string The canonical name
|
|
|
|
*/
|
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
return 'actions';
|
|
|
|
}
|
2010-02-17 13:55:05 +00:00
|
|
|
}
|