/**
  * @param \Twig_Environment $env
  * @param \Leapt\AdminBundle\Datalist\Field\DatalistFieldInterface $field
  * @param mixed $row
  * @return string
  * @throws \Exception
  */
 public function renderDatalistField(\Twig_Environment $env, DatalistFieldInterface $field, $row)
 {
     $blockNames = [$field->getType()->getBlockName() . '_field', '_' . $field->getDatalist()->getName() . '_' . $field->getName() . '_field'];
     $viewContext = new ViewContext();
     $field->getType()->buildViewContext($viewContext, $field, $row, $field->getOptions());
     return $this->renderBlock($env, $field->getDatalist(), $blockNames, $viewContext->all());
 }
 /**
  * @param \Leapt\AdminBundle\Datalist\ViewContext $viewContext
  * @param \Leapt\AdminBundle\Datalist\Field\DatalistFieldInterface $field
  * @param mixed $row
  * @param array $options
  */
 public function buildViewContext(ViewContext $viewContext, DatalistFieldInterface $field, $row, array $options)
 {
     if (isset($options['callback'])) {
         $viewContext['value'] = call_user_func($options['callback'], $row);
     } else {
         $viewContext['value'] = $field->getData($row);
     }
     $viewContext['field'] = $field;
     $viewContext['options'] = $options;
     $viewContext['translation_domain'] = $field->getDatalist()->getOption('translation_domain');
 }