コード例 #1
0
 private static function assertColumnEquals(ColumnInterface $column, string $name, string $type = ColumnType::class, array $options = null)
 {
     self::assertEquals($name, $column->getName());
     self::assertInstanceOf($type, $column->getType()->getInnerType());
     if (null !== $options) {
         self::assertEquals($options, $column->getOptions());
     }
 }
コード例 #2
0
ファイル: BaseType.php プロジェクト: rollerworks/datagrid
 public function buildHeaderView(HeaderView $view, ColumnInterface $column, array $options)
 {
     $blockName = (string) $options['block_name'];
     if ('' === $blockName) {
         $blockName = $view->datagrid->name . '_';
         // Child-columns must be prefixed with there parents name to prevent collisions.
         if (isset($options['parent_column'])) {
             $blockName .= $options['parent_column']->getName() . '_';
         }
         $blockName .= $column->getName();
     }
     $uniqueBlockPrefix = '_' . $blockName;
     $blockPrefixes = [];
     for ($type = $column->getType(); null !== $type; $type = $type->getParent()) {
         array_unshift($blockPrefixes, $type->getBlockPrefix());
     }
     $blockPrefixes[] = $uniqueBlockPrefix;
     $view->vars = array_replace($view->vars, ['label_attr' => $options['label_attr'], 'header_attr' => $options['header_attr'], 'cell_attr' => $options['header_attr'], 'label_translation_domain' => $options['label_translation_domain'], 'unique_block_prefix' => $uniqueBlockPrefix, 'block_prefixes' => $blockPrefixes, 'cache_key' => $uniqueBlockPrefix . '_' . $column->getType()->getBlockPrefix()]);
 }