Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
ckeditor_link
Commits
676587dd
Commit
676587dd
authored
Mar 16, 2017
by
Eric Bremner
Browse files
ISTWCMS-62: Ensuring that anchor links get processed during ckeditor link filtering.
parent
6d42294d
Changes
1
Hide whitespace changes
Inline
Side-by-side
ckeditor_link.module
View file @
676587dd
...
...
@@ -246,8 +246,27 @@ function ckeditor_link_filter_info() {
}
function
ckeditor_link_filter_process
(
$text
,
$filter
,
$format
,
$langcode
,
$cache
,
$cache_id
)
{
_ckeditor_link_filter_process
(
NULL
,
$langcode
);
return
preg_replace_callback
(
'`\bhref="'
.
preg_quote
(
base_path
(),
'`'
)
.
'([^?#"]+)`'
,
'_ckeditor_link_filter_process'
,
$text
);
_ckeditor_link_filter_process
(
NULL
,
$langcode
);
// If there are anchor links, process them and replace with full url.
if
(
preg_match
(
'/"#([^?#"]+)"/'
,
$text
))
{
$text
=
preg_replace_callback
(
'/"#([^?#"]+)"/'
,
'_ckeditor_link_filter_process_anchors'
,
$text
);
}
// If there are drupal links, process them and replace with full url.
if
(
preg_match
(
'`\bhref="'
.
preg_quote
(
base_path
(),
'`'
)
.
'([^?#"]+)`'
,
$text
))
{
$text
=
preg_replace_callback
(
'`\bhref="'
.
preg_quote
(
base_path
(),
'`'
)
.
'([^?#"]+)`'
,
'_ckeditor_link_filter_process'
,
$text
);
}
return
$text
;
}
function
_ckeditor_link_filter_process_anchors
(
$matches
,
$langcode
=
NULL
)
{
global
$base_root
;
$current_url
=
$base_root
.
request_uri
();
return
$current_url
.
'#'
.
$matches
[
1
];
}
function
_ckeditor_link_filter_process
(
$matches
,
$langcode
=
NULL
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment