Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Merge requests
!6309
Resolve
#3028968
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Resolve
#3028968
issue/drupal-3028968:3028968-
into
11.x
Overview
48
Commits
19
Pipelines
37
Changes
27
Open
Ivan Berdinsky
requested to merge
issue/drupal-3028968:3028968-
into
11.x
1 year ago
Overview
5
Commits
19
Pipelines
37
Changes
27
Expand
Closes
#3028968
0
0
Merge request reports
Compare
11.x
version 36
9dd01f18
3 weeks ago
version 35
18d35058
3 weeks ago
version 34
d8b910bf
3 months ago
version 33
43f7bd98
8 months ago
version 32
215a7411
8 months ago
version 31
17a4b201
8 months ago
version 30
d5ea23ab
8 months ago
version 29
de4f462b
8 months ago
version 28
5a268b20
8 months ago
version 27
b03d98ac
8 months ago
version 26
7a6e8eaa
8 months ago
version 25
2cc858a0
9 months ago
version 24
d996612d
9 months ago
version 23
1ec4e701
9 months ago
version 22
f33238e8
9 months ago
version 21
19eee83e
10 months ago
version 20
22842cca
10 months ago
version 19
4814c67d
10 months ago
version 18
7af5a8f0
10 months ago
version 17
fd7310b1
10 months ago
version 16
6e4a5a1b
10 months ago
version 15
e2db0ffd
11 months ago
version 14
21a489ba
11 months ago
version 13
5c4363d9
11 months ago
version 12
fb928fa7
11 months ago
version 11
1acd2e27
11 months ago
version 10
09e66676
11 months ago
version 9
7e9bb80a
11 months ago
version 8
08935e45
11 months ago
version 7
5437bbb9
11 months ago
version 6
689f5335
11 months ago
version 5
184d93f2
11 months ago
version 4
4ddd22ec
11 months ago
version 3
3b4ff60f
1 year ago
version 2
4ec23354
1 year ago
version 1
7d066e2a
1 year ago
11.x (HEAD)
and
latest version
latest version
4bc5c4a4
19 commits,
3 weeks ago
version 36
9dd01f18
18 commits,
3 weeks ago
version 35
18d35058
17 commits,
3 weeks ago
version 34
d8b910bf
16 commits,
3 months ago
version 33
43f7bd98
16 commits,
8 months ago
version 32
215a7411
16 commits,
8 months ago
version 31
17a4b201
16 commits,
8 months ago
version 30
d5ea23ab
15 commits,
8 months ago
version 29
de4f462b
13 commits,
8 months ago
version 28
5a268b20
13 commits,
8 months ago
version 27
b03d98ac
12 commits,
8 months ago
version 26
7a6e8eaa
11 commits,
8 months ago
version 25
2cc858a0
8 commits,
9 months ago
version 24
d996612d
8 commits,
9 months ago
version 23
1ec4e701
8 commits,
9 months ago
version 22
f33238e8
7 commits,
9 months ago
version 21
19eee83e
7 commits,
10 months ago
version 20
22842cca
7 commits,
10 months ago
version 19
4814c67d
7 commits,
10 months ago
version 18
7af5a8f0
6 commits,
10 months ago
version 17
fd7310b1
5 commits,
10 months ago
version 16
6e4a5a1b
5 commits,
10 months ago
version 15
e2db0ffd
5 commits,
11 months ago
version 14
21a489ba
5 commits,
11 months ago
version 13
5c4363d9
5 commits,
11 months ago
version 12
fb928fa7
5 commits,
11 months ago
version 11
1acd2e27
5 commits,
11 months ago
version 10
09e66676
5 commits,
11 months ago
version 9
7e9bb80a
5 commits,
11 months ago
version 8
08935e45
5 commits,
11 months ago
version 7
5437bbb9
4 commits,
11 months ago
version 6
689f5335
3 commits,
11 months ago
version 5
184d93f2
2 commits,
11 months ago
version 4
4ddd22ec
1 commit,
11 months ago
version 3
3b4ff60f
1 commit,
1 year ago
version 2
4ec23354
1 commit,
1 year ago
version 1
7d066e2a
1 commit,
1 year ago
27 files
+
471
−
550
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
27
Search (e.g. *.vue) (Ctrl+P)
core/lib/Drupal/Core/Render/Element/ListFilter.php
0 → 100644
+
105
−
0
Options
<?php
namespace
Drupal\Core\Render\Element
;
use
Drupal\Core\Render\Element
;
use
Drupal\Core\Render\Attribute\RenderElement
;
/**
* Provides a search element for filtering a list with JavaScript.
*
* - #list_container_selector: The CSS selector(s) of the container to search
* in. To use multiple selectors, separate them with commas, like
* '.selector-a, .selector-b'.
* - #list_item: (optional) The CSS selector, relative to the container, for the
* items to search for. If omitted, defaults to 'tbody tr'.
* - #list_text: (optional) The CSS selector, relative to a list item, of
* elements containing text to search for. This may produce multiple elements.
* Defaults to an empty string, which indicates that the whole of the list
* item should be considered searchable text.
* - #minimum_filter_length: (optional) The minimum length of the typed string
* before a filter is triggered. Defaults to 2.
* - #search_start_of_words: (optional) Whether the entered filter text will
* search anywhere within words, or only from the start of words. For example,
* if TRUE, typing 'ke' will not filter the word 'cake'. Defaults to FALSE.
* - #library: (optional) Override library to attach.
* - #announce: (optional) An array of strings to use for accessibility ARIA
* announcements when the number of visible items is changed. The keys are:
* - singular: Message to announce when only one item is visible.
* - plural: Message to announce when more than one items are visible. This
* must contain the '@count' placeholder.
* - all': Message to announce when all items are visible.
* - #debug: (optional) Set to TRUE to add CSS styling to highlight the
* different elements.
*/
#[RenderElement("list_filter")]
class
ListFilter
extends
Search
{
/**
* {@inheritdoc}
*/
public
function
getInfo
()
{
$class
=
static
::
class
;
return
[
'#input'
=>
TRUE
,
'#size'
=>
60
,
'#maxlength'
=>
128
,
'#pre_render'
=>
[
[
$class
,
'preRenderListFilterSearch'
],
],
'#theme'
=>
'input__search'
,
'#theme_wrappers'
=>
[
'form_element'
],
'#list_container_selector'
=>
'.filter-container'
,
'#list_item'
=>
'tbody tr'
,
'#minimum_filter_length'
=>
2
,
'#list_text'
=>
''
,
'#search_start_of_words'
=>
FALSE
,
'#announce'
=>
[
'singular'
=>
$this
->
t
(
'1 item is available in the modified list.'
),
'plural'
=>
$this
->
t
(
'@count items are available in the modified list.'
),
'all'
=>
$this
->
t
(
'All available items are listed.'
),
],
'#debug'
=>
FALSE
,
'#library'
=>
'core/drupal.list-filter'
,
];
}
/**
* Prepares a #type 'list_filter' render element for input.html.twig.
*
* @param array $element
* An associative array containing the properties of the element.
* Properties used: #title, #value, #description, #size, #maxlength,
* #placeholder, #required, #attributes.
*
* @return array
* The $element with prepared variables ready for input.html.twig.
*/
public
static
function
preRenderListFilterSearch
(
$element
)
{
$element
[
'#attributes'
][
'type'
]
=
'search'
;
Element
::
setAttributes
(
$element
,
[
'id'
,
'name'
,
'value'
,
'size'
,
'maxlength'
,
'placeholder'
]);
static
::
setAttributes
(
$element
,
[
'form-search'
]);
$element
[
'#attributes'
][
'class'
][]
=
'table-filter-text'
;
$element
[
'#attributes'
][
'data-table'
]
=
$element
[
'#list_container_selector'
];
$element
[
'#attributes'
][
'data-items'
]
=
$element
[
'#list_item'
];
if
(
$element
[
'#list_text'
])
{
$element
[
'#attributes'
][
'data-targets'
]
=
$element
[
'#list_text'
];
}
$element
[
'#attributes'
][
'data-min-length'
]
=
$element
[
'#minimum_filter_length'
];
if
(
$element
[
'#search_start_of_words'
])
{
$element
[
'#attributes'
][
'data-search-start'
]
=
'true'
;
}
if
(
$element
[
'#library'
])
{
$element
[
'#attached'
][
'library'
][]
=
$element
[
'#library'
];
}
$element
[
'#attributes'
][
'data-singular'
]
=
$element
[
'#announce'
][
'singular'
];
$element
[
'#attributes'
][
'data-plural'
]
=
$element
[
'#announce'
][
'plural'
];
$element
[
'#attributes'
][
'data-full'
]
=
$element
[
'#announce'
][
'all'
];
if
(
$element
[
'#debug'
])
{
$element
[
'#attributes'
][
'data-debug'
]
=
'true'
;
}
return
$element
;
}
}
Loading