vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php line 14

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Bundle\FrameworkBundle\Templating\Helper;
  11. @trigger_error('The '.ActionsHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.'E_USER_DEPRECATED);
  12. use Symfony\Component\HttpKernel\Controller\ControllerReference;
  13. use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
  14. use Symfony\Component\Templating\Helper\Helper;
  15. /**
  16.  * ActionsHelper manages action inclusions.
  17.  *
  18.  * @author Fabien Potencier <fabien@symfony.com>
  19.  *
  20.  * @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
  21.  */
  22. class ActionsHelper extends Helper
  23. {
  24.     private $handler;
  25.     public function __construct(FragmentHandler $handler)
  26.     {
  27.         $this->handler $handler;
  28.     }
  29.     /**
  30.      * Returns the fragment content for a given URI.
  31.      *
  32.      * @param string $uri     A URI
  33.      * @param array  $options An array of options
  34.      *
  35.      * @return string The fragment content
  36.      *
  37.      * @see FragmentHandler::render()
  38.      */
  39.     public function render($uri, array $options = [])
  40.     {
  41.         $strategy = isset($options['strategy']) ? $options['strategy'] : 'inline';
  42.         unset($options['strategy']);
  43.         return $this->handler->render($uri$strategy$options);
  44.     }
  45.     public function controller($controller$attributes = [], $query = [])
  46.     {
  47.         return new ControllerReference($controller$attributes$query);
  48.     }
  49.     /**
  50.      * {@inheritdoc}
  51.      */
  52.     public function getName()
  53.     {
  54.         return 'actions';
  55.     }
  56. }