|
@@ -41,7 +41,7 @@ class DatagridMapper
|
|
|
* @param array $fieldDescriptionOptions
|
|
|
* @return \Sonata\AdminBundle\Datagrid\DatagridMapper
|
|
|
*/
|
|
|
- public function add($name, array $fieldDescriptionOptions = array())
|
|
|
+ public function add($name, $type = null, array $fieldDescriptionOptions = array())
|
|
|
{
|
|
|
if ($name instanceof FieldDescriptionInterface) {
|
|
|
$fieldDescription = $name;
|
|
@@ -55,21 +55,12 @@ class DatagridMapper
|
|
|
$fieldDescriptionOptions
|
|
|
);
|
|
|
|
|
|
- $this->datagridBuilder->fixFieldDescription($this->admin, $fieldDescription, $fieldDescriptionOptions);
|
|
|
- $this->admin->addFilterFieldDescription($name, $fieldDescription);
|
|
|
-
|
|
|
- } else if (is_string($name) && $this->admin->hasFormFieldDescription($name)) {
|
|
|
- $fieldDescription = $this->admin->getFormFieldDescription($name);
|
|
|
-
|
|
|
} else {
|
|
|
throw new \RuntimeException('invalid state');
|
|
|
}
|
|
|
|
|
|
- // add the field with the FormBuilder
|
|
|
- $this->datagridBuilder->addFilter(
|
|
|
- $this->datagrid,
|
|
|
- $fieldDescription
|
|
|
- );
|
|
|
+ // add the field with the DatagridBuilder
|
|
|
+ $this->datagridBuilder->addFilter($this->datagrid, $type, $fieldDescription, $this->admin);
|
|
|
|
|
|
return $this;
|
|
|
}
|