1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
<?php
/**
* @file
* Hooks that can be implemented by other modules to extend CKEditor Link.
*/
/**
* Declare the path types handled by the module.
*
* @return
* An array of the types handled by the module.
* Each value is either a type name or a sub-array with the following
* attributes:
* - 'type'
* The type name. Required.
* - 'file'
* A file that will be included before other hooks are invoked.
* The file should be relative to the implementing module's directory.
*/
function hook_ckeditor_link_types() {
return array(
'mytype1',
array('type' => 'mytype2', 'file' => 'includes/mymodule.mytype2.inc'),
);
}
/**
* Alter types.
*
* @param $types
* The types returned by hook_ckeditor_link_types(). The types are keyed by
* 'MODULE.TYPE' for easy lookup.
*
* @see hook_ckeditor_link_types()
*/
function hook_ckeditor_link_types_alter(&$types) {
// Change types
}
/**
* Get autocomplete suggestions for the given string.
*
* Implementing modules should return only suggestions the current user has
* access to.
*
* @param $string
* The string to autocomplete.
* @param $limit
* The maximum number of suggestions to return.
*
* @return
* An array of suggestions where keys are non-aliased internal paths
* and values are titles.
*/
function hook_ckeditor_link_TYPE_autocomplete($string, $limit) {
$matches = array();
$matches['the-path/123'] = 'The title 1';
$matches['the-path/the-path-2/5'] = 'The title 2';
return $matches;
}
/**
* Alter autocomplete suggestions.
*
* @param $results
* The results returned by hook_ckeditor_link_TYPE_autocomplete.
* @param $string
* The string to autocomplete.
*
* @see hook_ckeditor_link_TYPE_autocomplete()
*/
function hook_ckeditor_link_autocomplete_alter(&$results, $string) {
// Change results.
}
/**
* Revert a path to a user-friendly title.
*
* @param $path
* The path to revert.
* @param $langcode
* The language code of the path if any. The implementing module may fix it
* if necessary, based on the given path.
*
* @return
* A title, FALSE if not found, or nothing if the implementing module is not
* responsible for the given path.
*/
function hook_ckeditor_link_TYPE_revert($path, &$langcode) {
//
}
/**
* Convert an internal path into an aliased and, if applicable, language
* prefixed URL.
*
* @param $path
* The internal path to convert.
* @param $langcode
* The language code of the path if any, the language code of the text to be
* filtered otherwise. It should only be used as a fallback when the content
* being linked to does not have any intrisic language.
*
* @return
* An URL alias, or nothing if the implementing module is not responsible for
* the given path.
*/
function hook_ckeditor_link_TYPE_url($path, $langcode) {
//
}
/**
* Add settings to the CKEditor Link settings form.
*
* @return
* An array containing the form elements to add.
*/
function hook_ckeditor_link_TYPE_settings() {
$form = array(
//
);
return $form;
}
|