diff --git a/Admin/Admin.php b/Admin/Admin.php index e136b16e83..6f189c11a6 100644 --- a/Admin/Admin.php +++ b/Admin/Admin.php @@ -866,7 +866,7 @@ public function getFilterParameters() /** * {@inheritdoc} */ - public function buildDatagrid() + public function buildDatagrid($context = 'list') { if ($this->datagrid) { return; @@ -890,7 +890,7 @@ public function buildDatagrid() } // initialize the datagrid - $this->datagrid = $this->getDatagridBuilder()->getBaseDatagrid($this, $filterParameters); + $this->datagrid = $this->getDatagridBuilder()->getBaseDatagrid($this, $filterParameters, $context); $this->datagrid->getPager()->setMaxPageLinks($this->maxPageLinks); @@ -1461,9 +1461,9 @@ public function createQuery($context = 'list') /** * {@inheritdoc} */ - public function getDatagrid() + public function getDatagrid($context = 'list') { - $this->buildDatagrid(); + $this->buildDatagrid($context); return $this->datagrid; } diff --git a/Admin/AdminInterface.php b/Admin/AdminInterface.php index 04f4f788b6..fd2e7a6bdd 100644 --- a/Admin/AdminInterface.php +++ b/Admin/AdminInterface.php @@ -17,6 +17,7 @@ use Sonata\AdminBundle\Builder\FormContractorInterface; use Sonata\AdminBundle\Builder\ListBuilderInterface; use Sonata\AdminBundle\Builder\RouteBuilderInterface; +use Sonata\AdminBundle\Datagrid\DatagridInterface; use Sonata\AdminBundle\Datagrid\ProxyQueryInterface; use Sonata\AdminBundle\Route\RouteCollection; use Sonata\AdminBundle\Route\RouteGeneratorInterface; @@ -116,9 +117,11 @@ public function getClass(); public function attachAdminClass(FieldDescriptionInterface $fieldDescription); /** - * @return \Sonata\AdminBundle\Datagrid\DatagridInterface + * @param string $context + * + * @return DatagridInterface */ - public function getDatagrid(); + public function getDatagrid($context = 'list'); /** * Set base controller name. diff --git a/Builder/DatagridBuilderInterface.php b/Builder/DatagridBuilderInterface.php index 6490a25d6a..c95172d57b 100644 --- a/Builder/DatagridBuilderInterface.php +++ b/Builder/DatagridBuilderInterface.php @@ -35,8 +35,9 @@ public function addFilter(DatagridInterface $datagrid, $type, FieldDescriptionIn /** * @param AdminInterface $admin * @param array $values + * @param string $context * * @return DatagridInterface */ - public function getBaseDatagrid(AdminInterface $admin, array $values = array()); + public function getBaseDatagrid(AdminInterface $admin, array $values = array(), $context = 'list'); }