public function renderField(Field $field, $data)
    {
        $value = $this->getDataFieldValue($data, $field->getName());

        if ($field->hasOption('template')) {
            return $this->container->get('templating')->render($field->getOption('template'), array('_field' => $field, 'value' => $value));
        }

        return $value;
    }
 public function renderField(Field $field, $data)
 {
     $value = $this->getDataFieldValue($data, $field->getName());
     if ($field->hasOption('template')) {
         return $this->action->renderView($field->getOption('template'), array('_field' => $field, 'value' => $value));
     }
     return $value;
     $template = $field->getTemplate();
     if (!$template) {
         $template = 'WhiteOctoberAdminBundle:Field:raw.html.twig';
         if ($type = $field->getType()) {
             switch ($type) {
                 case 'text':
                 case 'integer':
                     $template = 'WhiteOctoberAdminBundle:fields:raw.html.twig';
                     break;
                 case 'date':
                     $template = 'WhiteOctoberAdminBundle:fields:date.html.twig';
                     break;
             }
         }
     }
     return $this->action->renderView($template, array('_field' => $field, 'value' => $value));
 }
 public function testConstructorOptions()
 {
     $field = new Field("bar", array("label" => "Bar Label", "otherOption" => "foo"));
     $this->assertSame("Bar Label", $field->getLabel());
     $this->assertSame("foo", $field->getOption("otherOption"));
 }