diff --git a/src/Grid/AbstractGridType.php b/src/Grid/AbstractGridType.php index 01a56a2..f5704ea 100644 --- a/src/Grid/AbstractGridType.php +++ b/src/Grid/AbstractGridType.php @@ -26,14 +26,20 @@ abstract class AbstractGridType * @var DataGridServiceContainer */ protected $container; + /** + * @var array + */ + protected $params; /** * AbstractGridType constructor. * @param DataGridServiceContainer $container + * @param array $params */ - public function __construct(DataGridServiceContainer $container) + public function __construct(DataGridServiceContainer $container, array $params = []) { $this->container = $container; + $this->params = $params; } public abstract function buildGrid(DataGridBuilderInterface $builder): void; diff --git a/src/Grid/DataGridFactory.php b/src/Grid/DataGridFactory.php index aeaaee2..eb899ab 100644 --- a/src/Grid/DataGridFactory.php +++ b/src/Grid/DataGridFactory.php @@ -45,7 +45,7 @@ public function __construct(DataGridServiceContainer $container, ConfigurationCo } - public function createGrid(string $gridType, $dataSource): DataGridInterface + public function createGrid(string $gridType, $dataSource, array $params = []): DataGridInterface { if (!is_subclass_of($gridType, AbstractGridType::class)) { throw new InvalidArgumentException('Expected subclass of ' . AbstractGridType::class); @@ -53,7 +53,7 @@ public function createGrid(string $gridType, $dataSource): DataGridInterface $provider = DataProvider::create($dataSource, $this->container->getDoctrine()); /** @var AbstractGridType $type */ - $gridType = new $gridType($this->container); + $gridType = new $gridType($this->container, $params); return new DataGrid($gridType, $provider, $this->defaultConfiguration, $this->container); diff --git a/tests/columns/ImageColumnTest.php b/tests/columns/ImageColumnTest.php index 51f336b..c0c9b63 100644 --- a/tests/columns/ImageColumnTest.php +++ b/tests/columns/ImageColumnTest.php @@ -27,7 +27,7 @@ protected function setUp(): void 'alt' => function () { return 'Test alt'; }, - 'noImageMessage' => 'Empty', + 'emptyValue' => 'Empty', 'template' => $this->template ]); } @@ -49,7 +49,6 @@ public function testGetAlt(): void public function testGetNoImageMessage(): void { - $this->assertEquals('Empty', $this->testColumn->getNoImageMessage()); $entity = new class { public function getTestAttribute()