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
f64c8ae0
Commit
f64c8ae0
authored
Jan 07, 2012
by
Henri MEDOT
Browse files
Yet another final rewrite of the attachment process.
parent
603e743a
Changes
1
Hide whitespace changes
Inline
Side-by-side
ckeditor_link.module
View file @
f64c8ae0
...
...
@@ -156,25 +156,42 @@ function ckeditor_link_ckeditor_link_types() {
function
ckeditor_link_element_info_alter
(
&
$type
)
{
if
(
user_access
(
'access ckeditor link'
))
{
$type
[
'text_format'
][
'#pre_render'
][]
=
'ckeditor_link_text_format_pre_render'
;
$type
[
'form'
][
'#post_render'
][]
=
'ckeditor_link_form_post_render'
;
}
}
function
ckeditor_link_text_format_pre_render
(
$element
)
{
_ckeditor_link_has_text_format
(
TRUE
);
return
$element
;
}
function
_ckeditor_link_has_text_format
(
$set
=
FALSE
)
{
static
$has
=
FALSE
;
if
(
!
$set
)
{
return
$has
;
}
$has
=
TRUE
;
}
function
ckeditor_link_form_post_render
(
$content
,
$element
)
{
static
$added
;
if
(
!
isset
(
$added
))
{
$added
=
TRUE
;
drupal_add_css
(
drupal_get_path
(
'module'
,
'ckeditor_link'
)
.
'/ckeditor_link.css'
);
drupal_add_js
(
'misc/autocomplete.js'
);
drupal_add_js
(
array
(
'ckeditor_link'
=>
array
(
'module_path'
=>
base_path
()
.
drupal_get_path
(
'module'
,
'ckeditor_link'
),
'autocomplete_path'
=>
url
(
'ckeditor_link/autocomplete'
),
'revert_path'
=>
url
(
'ckeditor_link/revert'
),
'msg_invalid_path'
=>
t
(
'Link must be a valid internal path.'
),
'type_name'
=>
ckeditor_link_get_link_type_name
(),
'type_selected'
=>
(
bool
)
variable_get
(
'ckeditor_link_type_selected'
,
1
),
)),
'setting'
);
if
(
!
isset
(
$added
)
&&
_ckeditor_link_has_text_format
()
&&
(
$js
=
drupal_add_js
())
&&
isset
(
$js
[
'settings'
][
'data'
]))
{
$settings
=
call_user_func_array
(
'array_merge_recursive'
,
$js
[
'settings'
][
'data'
]);
if
(
isset
(
$settings
[
'ckeditor'
])
||
isset
(
$settings
[
'wysiwyg'
][
'configs'
][
'ckeditor'
]))
{
$added
=
TRUE
;
drupal_add_css
(
drupal_get_path
(
'module'
,
'ckeditor_link'
)
.
'/ckeditor_link.css'
);
drupal_add_js
(
'misc/autocomplete.js'
);
drupal_add_js
(
array
(
'ckeditor_link'
=>
array
(
'module_path'
=>
base_path
()
.
drupal_get_path
(
'module'
,
'ckeditor_link'
),
'autocomplete_path'
=>
url
(
'ckeditor_link/autocomplete'
),
'revert_path'
=>
url
(
'ckeditor_link/revert'
),
'msg_invalid_path'
=>
t
(
'Link must be a valid internal path.'
),
'type_name'
=>
ckeditor_link_get_link_type_name
(),
'type_selected'
=>
(
bool
)
variable_get
(
'ckeditor_link_type_selected'
,
1
),
)),
'setting'
);
}
}
return
$
elem
ent
;
return
$
cont
ent
;
}
/**
...
...
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