vendor/omines/datatables-bundle/src/Column/TwigStringColumn.php line 29

Open in your IDE?
  1. <?php
  2. /*
  3.  * Symfony DataTables Bundle
  4.  * (c) Omines Internetbureau B.V. - https://omines.nl/
  5.  *
  6.  * For the full copyright and license information, please view the LICENSE
  7.  * file that was distributed with this source code.
  8.  */
  9. declare(strict_types=1);
  10. namespace Omines\DataTablesBundle\Column;
  11. use Omines\DataTablesBundle\Exception\MissingDependencyException;
  12. use Twig\Environment;
  13. use Twig\Extension\StringLoaderExtension;
  14. /**
  15.  * TwigStringColumn.
  16.  *
  17.  * @author Marek VĂ­ger <marek.viger@gmail.com>
  18.  */
  19. class TwigStringColumn extends TwigColumn
  20. {
  21.     /**
  22.      * TwigStringColumn constructor.
  23.      */
  24.     public function __construct(Environment $twig null)
  25.     {
  26.         parent::__construct($twig);
  27.         if (!$this->twig->hasExtension(StringLoaderExtension::class)) {
  28.             throw new MissingDependencyException('You must have StringLoaderExtension enabled to use ' self::class);
  29.         }
  30.     }
  31.     protected function render($value$context)
  32.     {
  33.         return $this->twig->render('@DataTables/Column/twig_string.html.twig', [
  34.             'column' => $this,
  35.             'column_template' => $this->getTemplate(),
  36.             'row' => $context,
  37.             'value' => $value,
  38.         ]);
  39.     }
  40. }