Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
easy_breadcrumb-3321587
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
easy_breadcrumb-3321587
Commits
92ffa3ce
Commit
92ffa3ce
authored
5 years ago
by
Balazs Janos Tatar
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#170254
by mcdruid, tatarbj: Improvements for text handling.
parent
a0868126
No related branches found
Branches containing commit
Tags
8.x-1.0-alpha7
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
easy_breadcrumb.module
+8
-4
8 additions, 4 deletions
easy_breadcrumb.module
with
8 additions
and
4 deletions
easy_breadcrumb.module
+
8
−
4
View file @
92ffa3ce
...
...
@@ -149,7 +149,6 @@ function template_preprocess_easy_breadcrumb(&$variables) {
$variables
[
'list_type'
]
=
'http://data-vocabulary.org/Breadcrumb'
;
}
foreach
(
$breadcrumbs
as
$i
=>
$breadcrumb
)
{
$content
=
decode_entities
(
$breadcrumb
[
'content'
]);
if
(
isset
(
$breadcrumb
[
'url'
]))
{
$variables
[
'breadcrumb'
][
$i
]
=
'<span itemprop="title">'
;
...
...
@@ -158,7 +157,7 @@ function template_preprocess_easy_breadcrumb(&$variables) {
if
(
isset
(
$parsed_url
[
'query'
]))
{
parse_str
(
$parsed_url
[
'query'
],
$parsed_query
);
}
$variables
[
'breadcrumb'
][
$i
]
.
=
l
(
$content
,
$parsed_url
[
'path'
],
array
(
$variables
[
'breadcrumb'
][
$i
]
.
=
l
(
$
breadcrumb
[
'
content
'
]
,
$parsed_url
[
'path'
],
array
(
'attributes'
=>
array
(
'class'
=>
$breadcrumb
[
'class'
]),
'query'
=>
$parsed_query
,
'html'
=>
(
!
empty
(
$breadcrumb
[
'html'
]))
?
$breadcrumb
[
'html'
]
:
FALSE
,
...
...
@@ -168,7 +167,7 @@ function template_preprocess_easy_breadcrumb(&$variables) {
}
else
{
$class
=
implode
(
' '
,
$breadcrumb
[
'class'
]);
$variables
[
'breadcrumb'
][
$i
]
=
'<span class="'
.
$class
.
'" itemprop="title">'
.
check_plain
(
$
content
)
.
'</span>'
;
$variables
[
'breadcrumb'
][
$i
]
=
'<span class="'
.
$class
.
'" itemprop="title">'
.
$breadcrumb
[
'
content
'
]
.
'</span>'
;
}
}
$variables
[
'segments_quantity'
]
=
isset
(
$variables
[
'breadcrumb'
])
?
count
(
$variables
[
'breadcrumb'
])
:
0
;
...
...
@@ -382,6 +381,9 @@ function _easy_breadcrumb_obtain_page_title($page_text) {
* the generated breadcrumb item.
*/
function
_easy_breadcrumb_build_item
(
$item_title
,
array
$item_classes
,
$item_url
,
$as_link
=
TRUE
)
{
if
(
variable_get
(
EasyBreadcrumbConstants
::
DB_VAR_HTML_TAGS
,
TRUE
))
{
$item_title
=
filter_xss
(
$item_title
);
}
if
(
variable_get
(
EasyBreadcrumbConstants
::
DB_VAR_TRUNCATOR_MODE
,
FALSE
))
{
$item_title
=
truncate_utf8
(
$item_title
,
...
...
@@ -516,8 +518,10 @@ function _easy_breadcrumb_obtain_segment_title($normal_path, $valid_path, $segme
* normalized title.
*/
function
_easy_breadcrumb_normalize_text
(
$raw_text
)
{
// Filter the raw text against XSS.
$normalized_text
=
check_url
(
$raw_text
);
// Transforms '-hello--world_javascript-' on 'hello world javascript'.
$normalized_text
=
str_replace
(
array
(
'-'
,
'_'
),
' '
,
$
raw
_text
);
$normalized_text
=
str_replace
(
array
(
'-'
,
'_'
),
' '
,
$
normalized
_text
);
$normalized_text
=
trim
(
$normalized_text
);
$normalized_text
=
preg_replace
(
'/\s{2,}/'
,
' '
,
$normalized_text
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment