Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ckeditor_link
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
ckeditor_link
Commits
676587dd
Commit
676587dd
authored
7 years ago
by
Eric Bremner
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-62: Ensuring that anchor links get processed during ckeditor link filtering.
parent
6d42294d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ckeditor_link.module
+21
-2
21 additions, 2 deletions
ckeditor_link.module
with
21 additions
and
2 deletions
ckeditor_link.module
+
21
−
2
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
)
{
...
...
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