Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Drupal
Sharer toolbar module
Commits
87911b2b
Commit
87911b2b
authored
Jun 02, 2015
by
Philippe Mouchel
Browse files
Check array structure before rendering summary
parent
c25544c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
sharer_toolbar.inc
View file @
87911b2b
...
...
@@ -84,7 +84,13 @@ function _sharer_toolbar_generate_sharer_url(&$sharer_url, $variables) {
// Summary replacement
$truncate_summary
=
''
;
if
(
isset
(
$variables
[
'node'
]
->
field_catchline
)
&&
!
empty
(
$variables
[
'node'
]
->
field_catchline
))
{
$truncate_summary
=
truncate_utf8
(
drupal_html_to_text
(
$variables
[
'node'
]
->
field_catchline
[
LANGUAGE_NONE
][
0
][
'safe_value'
]),
200
,
TRUE
,
$add_ellipsis
=
TRUE
);
if
(
isset
(
$variables
[
'node'
]
->
field_catchline
[
LANGUAGE_NONE
]))
{
$summary
=
$variables
[
'node'
]
->
field_catchline
[
LANGUAGE_NONE
][
0
][
'safe_value'
];
}
else
{
$summary
=
$variables
[
'node'
]
->
field_catchline
[
0
][
'safe_value'
];
}
$truncate_summary
=
truncate_utf8
(
drupal_html_to_text
(
$summary
),
200
,
TRUE
,
$add_ellipsis
=
TRUE
);
}
$sharer_url
=
str_replace
(
'[:shared_summary:]'
,
$truncate_summary
,
$sharer_url
);
}
Write
Preview
Markdown
is supported
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