Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function renderContent(&$row, DatatableQuery $datatableQuery = null)
 {
     $fields = explode('.', $this->getDql());
     if (true === $datatableQuery->getImagineBundle()) {
         $galleryImages = '';
         $counter = 0;
         $images = count($row[$fields[0]]);
         if (0 === $images) {
             $row[$fields[0]] = $this->renderImage(null, $datatableQuery->getTwig());
         } else {
             foreach ($row[$fields[0]] as $image) {
                 $galleryImages = $galleryImages . $this->renderImage($image[$fields[1]], $datatableQuery->getTwig());
                 if (++$counter == $this->getViewLimit()) {
                     break;
                 }
             }
             $row[$fields[0]] = $galleryImages;
         }
     } else {
         throw new InvalidArgumentException('renderContent(): Bundle "LiipImagineBundle" does not exist or it is not enabled.');
     }
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function renderContent(&$item, DatatableQuery $datatableQuery = null)
 {
     if (true === $datatableQuery->getImagineBundle()) {
         $item[$this->getDql()] = $this->renderImage($item[$this->getDql()], $datatableQuery->getTwig());
     } else {
         $item[$this->getDql()] = $datatableQuery->getTwig()->render('SgDatatablesBundle:Helper:render_image.html.twig', array('image_name' => $item[$this->getDql()], 'path' => $this->getRelativePath()));
     }
 }