Ejemplo n.º 1
0
 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']);
 }
Ejemplo n.º 2
0
 /**
  * {@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;
 }
Ejemplo n.º 3
0
 /**
  * {@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'];
     }
 }
Ejemplo n.º 4
0
 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));
 }
Ejemplo n.º 5
0
 /**
  * @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]);
 }