Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
better_exposed_filters
Commits
212aca6b
Commit
212aca6b
authored
Jun 05, 2017
by
Mike Keran
Browse files
Issue #2655788 by mikeker: Allow token replacements in description field
parent
1d8aaefc
Changes
1
Hide whitespace changes
Inline
Side-by-side
better_exposed_filters.module
View file @
212aca6b
...
...
@@ -62,18 +62,32 @@ function better_exposed_filters_theme($existing, $type, $theme, $path) {
function
better_exposed_filters_form_views_ui_config_item_form_alter
(
&
$form
,
FormStateInterface
$form_state
)
{
// Checks if Token module is enabled.
if
(
!
\
Drupal
::
moduleHandler
()
->
moduleExists
(
'token'
))
{
$text
=
t
(
'Enable the Token module to allow token replacement in this field.'
);
if
(
empty
(
$form
[
'options'
][
'expose'
][
'description'
][
'#description'
]))
{
$form
[
'options'
][
'expose'
][
'description'
][
'#description'
]
=
$text
;
}
else
{
$form
[
'options'
][
'expose'
][
'description'
][
'#description'
]
.
=
"
$text
"
;
}
return
;
}
// Adds global token replacements, if available.
$form
[
'options'
][
'expose'
][
'global_replacement_tokens'
]
=
array
(
$text
=
t
(
'Tokens are allowed in this field. Replacement options can be found in the "Global replacement patterns" section, below.'
);
if
(
empty
(
$form
[
'options'
][
'expose'
][
'description'
][
'#description'
]))
{
$form
[
'options'
][
'expose'
][
'description'
][
'#description'
]
=
$text
;
}
else
{
$form
[
'options'
][
'expose'
][
'description'
][
'#description'
]
.
=
"
$text
"
;
}
$form
[
'options'
][
'expose'
][
'global_replacement_tokens'
]
=
[
'#title'
=>
t
(
'Global replacement patterns (for description field only)'
),
'#type'
=>
'details'
,
'#weight'
=>
151
,
)
;
$form
[
'options'
][
'expose'
][
'global_replacement_tokens'
][
'list'
]
=
array
(
]
;
$form
[
'options'
][
'expose'
][
'global_replacement_tokens'
][
'list'
]
=
[
'#theme'
=>
'token_tree_link'
,
'#token_types'
=>
array
()
,
)
;
'#token_types'
=>
[]
,
]
;
}
/******************************************************************************
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment