public function testBuildViewWithoutScope() { $this->nameStrategy->expects($this->never())->method('buildGridFullName'); $view = $this->getBlockView(new DatagridType($this->nameStrategy), ['grid_name' => 'test-grid', 'grid_parameters' => ['foo' => 'bar']]); $this->assertEquals('test-grid', $view->vars['grid_name']); $this->assertEquals('test-grid', $view->vars['grid_full_name']); $this->assertFalse(isset($view->vars['grid_scope'])); $this->assertEquals(['foo' => 'bar', 'enableFullScreenLayout' => true], $view->vars['grid_parameters']); }
/** * {@inheritDoc} */ public function getConfigurationForGrid($name) { $gridName = $this->nameStrategy->parseGridName($name); $result = $this->configurationProvider->getConfiguration($gridName); $gridScope = $this->nameStrategy->parseGridScope($name); if ($gridScope) { $result->offsetSet('scope', $gridScope); } return $result; }
/** * {@inheritdoc} */ public function buildView(BlockView $view, BlockInterface $block, array $options) { $view->vars['grid_name'] = $options['grid_name']; $view->vars['grid_parameters'] = $options['grid_parameters']; if (!empty($options['grid_scope'])) { $view->vars['grid_scope'] = $options['grid_scope']; $view->vars['grid_full_name'] = $this->nameStrategy->buildGridFullName($view->vars['grid_name'], $view->vars['grid_scope']); } else { $view->vars['grid_full_name'] = $view->vars['grid_name']; } }
public function testBuildGridFullNameWorks() { $expectedFullName = 'test-grid:test-scope'; $gridName = 'test-grid'; $gridScope = 'test-scope'; $this->nameStrategy->expects($this->once())->method('buildGridFullName')->will($this->returnValue($expectedFullName)); $this->assertEquals($expectedFullName, $this->twigExtension->buildGridFullName($gridName, $gridScope)); }
/** * @param DatagridInterface $grid * @param array $params * @return string */ protected function generateUrl(DatagridInterface $grid, $params) { $gridFullName = $this->nameStrategy->buildGridFullName($grid->getName(), $grid->getScope()); return $this->router->generate(self::ROUTE, ['gridName' => $gridFullName, $gridFullName => $params]); }