• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

contributte / datagrid / 8685602316

13 Mar 2024 12:24PM UTC coverage: 34.102%. Remained the same
8685602316

push

github

web-flow
[7.x] Next (#1060)

* PHP 8.0

* Translator: switch from ITranslator to Translator (#973)

* [7.x] Bootstrap 5 + PHP 8 + vanilla javascript (#1021)

* Bootstrap 5

* Bootstrap 5 (docs)

* Bootstrap 5

* form-control -> form-select

* Bump bootstrap-select for Bootstrap 5 support

* Removed `input-sm` from Bootstrap 3

See https://getbootstrap.com/docs/4.0/migration/#forms-1

* Bootstrap 5: When selectpicker, replace form-select classes with form-control and refresh it

* Hide `underline` also for `dropdown-item`. And merged into one CSS rule.

* Update the filterMultiSelect initialization

* Text-align: left -> start

Co-authored-by: Radim Vaculík <radim.vaculik@gmail.com>
Co-authored-by: Jaroslav Líbal <jaroslav.libal@neatous.cz>

* [7.x] phpstan-deprecation-rules (#1061)

* Fix sort

* Add method for setting custom Action href, v6.x (#853)

* [7.x] Nextras ORM 4 support, closes #984

* Fix ElasticsearchDataSource.php data source (#1041)

* Error: Typed property Ublaboo\DataGrid\InlineEdit\InlineEdit::$itemID must not be accessed before initialization

* composer: allow-plugins: php-http/discovery

* ItemDetailForm: $httpPost: Typed property must not be accessed...

* phpstan: revert  --memory-limit=4G

* NetteDatabaseSelectionHelper: Context -> Explorer, getSupplementalDriver -> getDriver

* Update README.md

* Templates: fix variables

* data-bs-toggle attribute for multiaction button (#1072)

* dependabot.yml (#1078)

* Allow nette/utils:4.0 (#1077)

* Add onColumnShow and onColumnHide event methods (#1076)

* Add onColumnShow and onColumnHide event methods

* Add native type array

* Removed duplicity

* Return value of BackedEnum when reading Doctrine entity property. (#1081)

* Return value of BackedEnum when reading array value (#1083)

* Added method to check if filter is on default values; Closes #1082 (#1084)

* ublaboo -> contributte (#1067) (#1075)

* Delete depe... (continued)

117 of 435 new or added lines in 54 files covered. (26.9%)

1455 existing lines in 67 files now uncovered.

1124 of 3296 relevant lines covered (34.1%)

0.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Filter/FilterMultiSelect.php
1
<?php declare(strict_types = 1);
2

3
namespace Contributte\Datagrid\Filter;
4

5
use Contributte\Datagrid\Datagrid;
6
use Nette\Application\UI\Form;
7
use Nette\Forms\Container;
8
use Nette\Forms\Controls\BaseControl;
9
use UnexpectedValueException;
10

11
class FilterMultiSelect extends FilterSelect
12
{
13

14
        protected ?string $type = 'multi-select';
15

16
        protected array $attributes = [
17
                'class' => ['form-select', 'selectpicker', 'form-select-sm'],
18
                'data-selected-text-format' => ['count'],
19
        ];
20

21
        public function __construct(
22
                Datagrid $grid,
23
                string $key,
24
                string $name,
25
                array $options,
26
                string $column
27
        )
28
        {
UNCOV
29
                parent::__construct($grid, $key, $name, $options, $column);
×
30

NEW
31
                $this->addAttribute('data-selected-icon-check', Datagrid::$iconPrefix . 'check');
×
32
        }
33

34
        /**
35
         * Get filter condition
36
         */
37
        public function getCondition(): array
38
        {
UNCOV
39
                $return = [$this->column => []];
×
40

UNCOV
41
                foreach ($this->getValue() as $value) {
×
UNCOV
42
                        $return[$this->column][] = $value;
×
43
                }
44

UNCOV
45
                return $return;
×
46
        }
47

48
        protected function addControl(
49
                Container $container,
50
                string $key,
51
                string $name,
52
                array $options
53
        ): BaseControl
54
        {
55
                /**
56
                 * Set some translated texts
57
                 */
NEW
58
                $form = $container->lookup(Form::class);
×
59

60
                if (!$form instanceof Form) {
×
61
                        throw new UnexpectedValueException();
×
62
                }
63

64
                $translator = $form->getTranslator();
×
65

UNCOV
66
                if ($translator === null) {
×
UNCOV
67
                        throw new UnexpectedValueException();
×
68
                }
69

UNCOV
70
                $this->addAttribute(
×
71
                        'title',
×
NEW
72
                        $translator->translate('contributte_datagrid.multiselect_choose')
×
73
                );
UNCOV
74
                $this->addAttribute(
×
75
                        'data-i18n-selected',
×
NEW
76
                        $translator->translate('contributte_datagrid.multiselect_selected')
×
77
                );
78

79
                /**
80
                 * Add input to container
81
                 */
UNCOV
82
                $input = $container->addMultiSelect($key, $name, $options);
×
83

UNCOV
84
                $this->addAttributes($input);
×
85

UNCOV
86
                return $input;
×
87
        }
88

89
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc