Révision da542b7b
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/media/includes/media.browser.inc | ||
---|---|---|
14 | 14 |
|
15 | 15 |
$params = media_get_browser_params(); |
16 | 16 |
|
17 |
// If we just did a multiple upload, do the multiform file edit. The flag that |
|
18 |
// tells us that we need to do this is $params['render_multi_edit_form']. |
|
19 |
if (isset($params['render_multi_edit_form']) && isset($params['fid']) && module_exists('media_bulk_upload')) { |
|
20 |
module_load_include('inc', 'media_bulk_upload', 'includes/media_bulk_upload.pages'); |
|
21 |
$files = file_load_multiple($params['fid']); |
|
22 |
$multi_edit_form = media_bulk_upload_file_page_edit_multiple($files); |
|
23 |
$multi_edit_form['buttons']['cancel']['#access'] = FALSE; |
|
24 |
return $multi_edit_form; |
|
25 |
} |
|
26 |
|
|
17 | 27 |
// If one or more files have been selected, the browser interaction is now |
18 | 28 |
// complete. Return empty page content to the dialog which now needs to close, |
19 | 29 |
// but populate Drupal.settings with information about the selected files. |
drupal7/sites/all/modules/media/js/media.popups.js | ||
---|---|---|
351 | 351 |
}, |
352 | 352 |
zIndex: Drupal.settings.media.dialogOptions.zindex, |
353 | 353 |
close: function (event, ui) { |
354 |
$(event.target).remove(); |
|
354 |
var elem = $(event.target); |
|
355 |
var id = elem.attr('id'); |
|
356 |
if(id == 'mediaStyleSelector') { |
|
357 |
$(this).dialog("destroy"); |
|
358 |
$('#mediaStyleSelector').remove(); |
|
359 |
} |
|
360 |
else { |
|
361 |
$(this).dialog("destroy"); |
|
362 |
$('#mediaBrowser').remove(); |
|
363 |
} |
|
355 | 364 |
} |
356 | 365 |
}; |
357 | 366 |
}; |
drupal7/sites/all/modules/media/media.info | ||
---|---|---|
24 | 24 |
; We have to add a fake version so Git checkouts do not fail Media dependencies |
25 | 25 |
version = 7.x-2.x-dev |
26 | 26 |
|
27 |
; Information added by Drupal.org packaging script on 2016-10-31
|
|
28 |
version = "7.x-2.0-beta5"
|
|
27 |
; Information added by Drupal.org packaging script on 2016-11-15
|
|
28 |
version = "7.x-2.0-beta7"
|
|
29 | 29 |
core = "7.x" |
30 | 30 |
project = "media" |
31 |
datestamp = "1477886358"
|
|
31 |
datestamp = "1479212995"
|
|
32 | 32 |
|
drupal7/sites/all/modules/media/media.module | ||
---|---|---|
266 | 266 |
// Get the current element and count the number of files. |
267 | 267 |
$current_element = $form; |
268 | 268 |
foreach ($form_parents as $parent) { |
269 |
$current_element = $current_element[$parent]; |
|
269 |
if (isset($current_element[$parent])) { |
|
270 |
$current_element = $current_element[$parent]; |
|
271 |
} |
|
272 |
else { |
|
273 |
$current_element = NULL; |
|
274 |
break; |
|
275 |
} |
|
270 | 276 |
} |
271 | 277 |
$current_file_count = isset($current_element['#file_upload_delta']) ? $current_element['#file_upload_delta'] : 0; |
272 | 278 |
|
... | ... | |
346 | 352 |
if ($form['#field']['type'] == 'file' && $form['instance']['widget']['type']['#value'] == 'media_generic') { |
347 | 353 |
$form['instance']['settings']['file_extensions']['#title'] = t('Allowed file extensions for uploaded files'); |
348 | 354 |
$form['instance']['settings']['file_extensions']['#maxlength'] = 255; |
355 |
$form['instance']['settings']['file_extensions']['#description'] .= '<br />' . t('If empty, the file extensions list will be composed automatically using the allowed file types.'); |
|
356 |
$form['instance']['settings']['file_extensions']['#required'] = FALSE; |
|
349 | 357 |
} |
350 | 358 |
|
351 | 359 |
// On image fields using the media widget we remove the alt/title fields. |
... | ... | |
363 | 371 |
if ($form['instance']['widget']['type']['#value'] == 'media_generic' && isset($form['#field']['settings']['uri_scheme'])) { |
364 | 372 |
$form['#validate'][] = 'media_field_instance_validate'; |
365 | 373 |
} |
366 |
|
|
367 |
if ($form['#instance']['entity_type'] == 'file') { |
|
368 |
$form['instance']['settings']['wysiwyg_override'] = array( |
|
369 |
'#type' => 'checkbox', |
|
370 |
'#title' => t('Override in WYSIWYG'), |
|
371 |
'#description' => t('If checked, then this field may be overridden in the WYSIWYG editor.'), |
|
372 |
'#default_value' => isset($form['#instance']['settings']['wysiwyg_override']) ? $form['#instance']['settings']['wysiwyg_override'] : TRUE, |
|
373 |
); |
|
374 |
} |
|
375 | 374 |
} |
376 | 375 |
|
377 | 376 |
/** |
... | ... | |
1141 | 1140 |
); |
1142 | 1141 |
} |
1143 | 1142 |
|
1144 |
// Override the fields of the file when requested by the WYSIWYG. |
|
1145 |
if (isset($file->override) && isset($file->override['fields'])) { |
|
1146 |
$instance = field_info_instances('file', $file->type); |
|
1147 |
foreach ($file->override['fields'] as $field_name => $value) { |
|
1148 |
if (!isset($instance[$field_name]['settings']) || !isset($instance[$field_name]['settings']['wysiwyg_override']) || $instance[$field_name]['settings']['wysiwyg_override']) { |
|
1149 |
$file->{$field_name} = $value;} |
|
1150 |
} |
|
1151 |
} |
|
1152 |
|
|
1153 | 1143 |
// Alt and title are special. |
1154 | 1144 |
// @see file_entity_file_load |
1155 | 1145 |
$alt = variable_get('file_entity_alt', '[file:field_file_image_alt_text]'); |
drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.info | ||
---|---|---|
13 | 13 |
files[] = includes/MediaBrowserBulkUpload.inc |
14 | 14 |
files[] = tests/media_bulk_upload.test |
15 | 15 |
|
16 |
; Information added by Drupal.org packaging script on 2016-10-31
|
|
17 |
version = "7.x-2.0-beta5"
|
|
16 |
; Information added by Drupal.org packaging script on 2016-11-15
|
|
17 |
version = "7.x-2.0-beta7"
|
|
18 | 18 |
core = "7.x" |
19 | 19 |
project = "media" |
20 |
datestamp = "1477886358"
|
|
20 |
datestamp = "1479212995"
|
|
21 | 21 |
|
drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.module | ||
---|---|---|
97 | 97 |
$files = $form_state['files']; |
98 | 98 |
$url = 'media/browser'; |
99 | 99 |
$parameters = array('query' => array('render' => 'media-popup', 'fid' => array_keys($files))); |
100 |
// Pass in "render_multi_edit_form" as a parameter to signal to the |
|
101 |
// media_browser() function that we need to edit multiple files. |
|
102 |
$parameters['query']['render_multi_edit_form'] = TRUE; |
|
100 | 103 |
} |
101 | 104 |
|
102 | 105 |
// If $url is set, we had some sort of upload, so redirect the form. |
... | ... | |
105 | 108 |
} |
106 | 109 |
} |
107 | 110 |
|
111 |
/** |
|
112 |
* Implements hook_multiform_get_form_alter(). |
|
113 |
* |
|
114 |
* Alter the multiform that is used after uploading multiple files. |
|
115 |
*/ |
|
116 |
function media_bulk_upload_multiform_get_form_alter($form_state_save, &$redirect, $all_args) { |
|
117 |
|
|
118 |
// Was this form submitted while in the Media browser? |
|
119 |
if (isset($redirect['#media_browser']) && !empty($form_state_save['input'])) { |
|
120 |
|
|
121 |
// The $all_args should be an array of arrays, with the second element of |
|
122 |
// the inner array being the file. For details on this structure, see |
|
123 |
// the media_bulk_upload_file_page_edit_multiple() function. |
|
124 |
$fids = array(); |
|
125 |
foreach ($all_args as $arg) { |
|
126 |
if (count($arg) == 2) { |
|
127 |
$file = $arg[1]; |
|
128 |
$fids[] = $file->fid; |
|
129 |
} |
|
130 |
} |
|
131 |
|
|
132 |
// If we found something, instruct the Media browser to close and attach |
|
133 |
// the files to whatever they need to be attached to. |
|
134 |
if (!empty($fids)) { |
|
135 |
$url = 'media/browser'; |
|
136 |
$parameters = array('query' => array('render' => 'media-popup', 'fid' => $fids)); |
|
137 |
$redirect['redirect'] = array($url, $parameters); |
|
138 |
} |
|
139 |
} |
|
140 |
} |
|
141 |
|
|
108 | 142 |
/** |
109 | 143 |
* Return a URL for editing an files. |
110 | 144 |
* |
drupal7/sites/all/modules/media/modules/media_internet/media_internet.info | ||
---|---|---|
12 | 12 |
files[] = includes/MediaInternetValidationException.inc |
13 | 13 |
files[] = tests/media_internet.test |
14 | 14 |
|
15 |
; Information added by Drupal.org packaging script on 2016-10-31
|
|
16 |
version = "7.x-2.0-beta5"
|
|
15 |
; Information added by Drupal.org packaging script on 2016-11-15
|
|
16 |
version = "7.x-2.0-beta7"
|
|
17 | 17 |
core = "7.x" |
18 | 18 |
project = "media" |
19 |
datestamp = "1477886358"
|
|
19 |
datestamp = "1479212995"
|
|
20 | 20 |
|
drupal7/sites/all/modules/media/modules/media_internet/tests/media_internet_test.info | ||
---|---|---|
7 | 7 |
files[] = includes/MediaInternetTestStreamWrapper.inc |
8 | 8 |
files[] = includes/MediaInternetTestHandler.inc |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2016-10-31
|
|
11 |
version = "7.x-2.0-beta5"
|
|
10 |
; Information added by Drupal.org packaging script on 2016-11-15
|
|
11 |
version = "7.x-2.0-beta7"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "media" |
14 |
datestamp = "1477886358"
|
|
14 |
datestamp = "1479212995"
|
|
15 | 15 |
|
drupal7/sites/all/modules/media/modules/media_migrate_file_types/media_migrate_file_types.info | ||
---|---|---|
8 | 8 |
|
9 | 9 |
configure = admin/structure/file-types/upgrade |
10 | 10 |
|
11 |
; Information added by Drupal.org packaging script on 2016-10-31
|
|
12 |
version = "7.x-2.0-beta5"
|
|
11 |
; Information added by Drupal.org packaging script on 2016-11-15
|
|
12 |
version = "7.x-2.0-beta7"
|
|
13 | 13 |
core = "7.x" |
14 | 14 |
project = "media" |
15 |
datestamp = "1477886358"
|
|
15 |
datestamp = "1479212995"
|
|
16 | 16 |
|
drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.file_usage.inc | ||
---|---|---|
12 | 12 |
* is heavy-handed, and should be replaced when Drupal's filter system is |
13 | 13 |
* context-aware. |
14 | 14 |
*/ |
15 |
function media_wysiwyg_field_attach_insert($entity_type, $entity) {
|
|
15 |
function media_wysiwyg_entity_insert($entity, $entity_type) {
|
|
16 | 16 |
_media_wysiwyg_filter_add_file_usage_from_fields($entity_type, $entity); |
17 | 17 |
} |
18 | 18 |
|
... | ... | |
21 | 21 |
* |
22 | 22 |
* @see media_field_attach_insert(). |
23 | 23 |
*/ |
24 |
function media_wysiwyg_field_attach_update($entity_type, $entity) {
|
|
24 |
function media_wysiwyg_entity_update($entity, $entity_type) {
|
|
25 | 25 |
_media_wysiwyg_filter_add_file_usage_from_fields($entity_type, $entity); |
26 | 26 |
} |
27 | 27 |
|
... | ... | |
92 | 92 |
foreach (media_wysiwyg_filter_fields_with_text_filtering($entity_type, $entity) as $field_name) { |
93 | 93 |
if ($field_items = field_get_items($entity_type, $entity, $field_name)) { |
94 | 94 |
foreach ($field_items as $field_item) { |
95 |
preg_match_all(MEDIA_WYSIWYG_TOKEN_REGEX, $field_item['value'], $matches); |
|
96 |
foreach ($matches[0] as $tag) { |
|
97 |
$tag = str_replace(array('[[', ']]'), '', $tag); |
|
98 |
$tag_info = drupal_json_decode($tag); |
|
99 |
if (isset($tag_info['fid']) && $tag_info['type'] == 'media') { |
|
100 |
$file_references[] = $tag_info; |
|
95 |
if (!empty($field_item['value'])) { |
|
96 |
preg_match_all(MEDIA_WYSIWYG_TOKEN_REGEX, $field_item['value'], $matches); |
|
97 |
foreach ($matches[0] as $tag) { |
|
98 |
$tag = str_replace(array('[[', ']]'), '', $tag); |
|
99 |
$tag_info = drupal_json_decode($tag); |
|
100 |
if (isset($tag_info['fid']) && $tag_info['type'] == 'media') { |
|
101 |
$file_references[] = $tag_info; |
|
102 |
} |
|
101 | 103 |
} |
102 |
} |
|
103 | 104 |
|
104 |
preg_match_all(MEDIA_WYSIWYG_TOKEN_REGEX, $field_item['value'], $matches_alt); |
|
105 |
foreach ($matches_alt[0] as $tag) { |
|
106 |
$tag = urldecode($tag); |
|
107 |
$tag_info = drupal_json_decode($tag); |
|
108 |
if (isset($tag_info['fid']) && $tag_info['type'] == 'media') { |
|
109 |
$file_references[] = $tag_info; |
|
105 |
preg_match_all(MEDIA_WYSIWYG_TOKEN_REGEX, $field_item['value'], $matches_alt); |
|
106 |
foreach ($matches_alt[0] as $tag) { |
|
107 |
$tag = urldecode($tag); |
|
108 |
$tag_info = drupal_json_decode($tag); |
|
109 |
if (isset($tag_info['fid']) && $tag_info['type'] == 'media') { |
|
110 |
$file_references[] = $tag_info; |
|
111 |
} |
|
110 | 112 |
} |
111 | 113 |
} |
112 | 114 |
} |
drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc | ||
---|---|---|
5 | 5 |
* Functions related to the WYSIWYG editor and the media input filter. |
6 | 6 |
*/ |
7 | 7 |
|
8 |
define('MEDIA_WYSIWYG_TOKEN_REGEX', '/\[\[.*?\]\]/s'); |
|
8 |
define('MEDIA_WYSIWYG_TOKEN_REGEX', '/\[\[\{"fid".*?\]\]/s');
|
|
9 | 9 |
|
10 | 10 |
/** |
11 | 11 |
* Filter callback for media markup filter. |
... | ... | |
27 | 27 |
return $rendered_text; |
28 | 28 |
} |
29 | 29 |
|
30 |
/** |
|
31 |
* Filter callback to remove paragraph tags surrounding embedded media. |
|
32 |
*/ |
|
33 |
function media_wysiwyg_filter_paragraph_fix($text) { |
|
34 |
$html_dom = filter_dom_load($text); |
|
35 |
foreach ($html_dom->getElementsByTagName('p') as $paragraph) { |
|
36 |
if (preg_match(MEDIA_WYSIWYG_TOKEN_REGEX, $paragraph->nodeValue)) { |
|
37 |
$sibling = $paragraph->firstChild; |
|
38 |
do { |
|
39 |
$next = $sibling->nextSibling; |
|
40 |
$paragraph->parentNode->insertBefore($sibling, $paragraph); |
|
41 |
} while ($sibling = $next); |
|
42 |
$paragraph->parentNode->removeChild($paragraph); |
|
43 |
} |
|
44 |
} |
|
45 |
$text = filter_dom_serialize($html_dom); |
|
46 |
return $text; |
|
47 |
} |
|
48 |
|
|
30 | 49 |
/** |
31 | 50 |
* Parses the contents of a CSS declaration block. |
32 | 51 |
* |
... | ... | |
133 | 152 |
$tag_info['attributes']['class'] = explode(" ", $tag_info['attributes']['class']); |
134 | 153 |
} |
135 | 154 |
|
136 |
// Grab the potentially overrided fields from the file.
|
|
155 |
// Grab the potentially overridden fields from the file.
|
|
137 | 156 |
$fields = media_wysiwyg_filter_field_parser($tag_info); |
138 | 157 |
foreach ($fields as $key => $value) { |
139 | 158 |
$file->{$key} = $value; |
... | ... | |
146 | 165 |
|
147 | 166 |
if (!empty($tag_info['attributes']) && is_array($tag_info['attributes'])) { |
148 | 167 |
$settings['attributes'] = array_intersect_key($tag_info['attributes'], array_flip($attribute_whitelist)); |
149 |
$settings['fields'] = $fields; |
|
150 | 168 |
|
151 | 169 |
// Many media formatters will want to apply width and height independently |
152 | 170 |
// of the style attribute or the corresponding HTML attributes, so pull |
... | ... | |
172 | 190 |
} |
173 | 191 |
} |
174 | 192 |
} |
193 |
// Update file metadata from the potentially overridden tag info. |
|
194 |
foreach (array('width', 'height') as $dimension) { |
|
195 |
if (isset($settings['attributes'][$dimension])) { |
|
196 |
$file->metadata[$dimension] = $settings['attributes'][$dimension]; |
|
197 |
} |
|
198 |
} |
|
175 | 199 |
} |
176 | 200 |
catch (Exception $e) { |
177 | 201 |
watchdog('media', 'Unable to render media from %tag. Error: %error', array('%tag' => $tag, '%error' => $e->getMessage())); |
... | ... | |
266 | 290 |
$parsed_field = explode('[', str_replace(']', '', $field_name)); |
267 | 291 |
$ref = &$fields; |
268 | 292 |
|
293 |
// Certain types of fields, because of differences in markup, end up |
|
294 |
// here with incomplete arrays. Make a best effort to support as many |
|
295 |
// types of fields as possible. |
|
296 |
// Single-value select lists show up here with only 2 array items. |
|
297 |
if (count($parsed_field) == 2) { |
|
298 |
$info = field_info_field($parsed_field[0]); |
|
299 |
if ($info && !empty($info['columns'])) { |
|
300 |
// Assume single-value. |
|
301 |
$parsed_field[] = 0; |
|
302 |
// Next tack on the column for this field. |
|
303 |
$parsed_field[] = key($info['columns']); |
|
304 |
} |
|
305 |
} |
|
306 |
// Multi-value select lists show up here with 3 array items. |
|
307 |
elseif (count($parsed_field) == 3 && is_numeric($parsed_field[2])) { |
|
308 |
$info = field_info_field($parsed_field[0]); |
|
309 |
// They just need the value column. |
|
310 |
$parsed_field[3] = key($info['columns']); |
|
311 |
} |
|
312 |
|
|
269 | 313 |
// Each key of the field needs to be the child of the previous key. |
270 | 314 |
foreach ($parsed_field as $key) { |
271 | 315 |
if (!isset($ref[$key])) { |
... | ... | |
307 | 351 |
// between function calls. Since media_process_form is multiple times |
308 | 352 |
// with same form, this function is also called multiple times. |
309 | 353 |
static $tagmap = array(); |
310 |
preg_match_all("/\[\[.*?\]\]/s", $text, $matches, PREG_SET_ORDER);
|
|
354 |
preg_match_all(MEDIA_WYSIWYG_TOKEN_REGEX, $text, $matches, PREG_SET_ORDER);
|
|
311 | 355 |
foreach ($matches as $match) { |
312 | 356 |
// We see if tagContent is already in $tagMap, if not we add it |
313 | 357 |
// to $tagmap. If we return an empty array, we break embeddings of the same |
drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.pages.inc | ||
---|---|---|
91 | 91 |
field_attach_form('file', $file, $form['options']['fields'], $form_state); |
92 | 92 |
$instance = field_info_instances('file', $file->type); |
93 | 93 |
foreach ($instance as $field_name => $field_value) { |
94 |
if (isset($instance[$field_name]['settings']) && isset($instance[$field_name]['settings']['wysiwyg_override']) && !$instance[$field_name]['settings']['wysiwyg_override']) { |
|
95 |
unset($form['options']['fields'][$field_name]); |
|
96 |
} |
|
94 |
$info = field_info_field($field_name); |
|
95 |
// Only single valued fields can be overridden. |
|
96 |
$allow = $info['cardinality'] == 1 && !empty($instance[$field_name]['settings']['wysiwyg_override']); |
|
97 |
$form['options']['fields'][$field_name]['#access'] = $allow; |
|
97 | 98 |
} |
98 | 99 |
|
99 | 100 |
// Similar to a form_alter, but we want this to run first so that |
drupal7/sites/all/modules/media/modules/media_wysiwyg/js/media_wysiwyg.filter.js | ||
---|---|---|
43 | 43 |
// Re-build the media if the macro has changed from the tagmap. |
44 | 44 |
if (!media && media_definition.fid) { |
45 | 45 |
Drupal.media.filter.ensureSourceMap(); |
46 |
var source = Drupal.settings.mediaSourceMap[media_definition.fid]; |
|
47 |
media = document.createElement(source.tagName); |
|
48 |
media.src = source.src; |
|
49 |
media.innerHTML = source.innerHTML; |
|
46 |
var source; |
|
47 |
if (source = Drupal.settings.mediaSourceMap[media_definition.fid]) { |
|
48 |
media = document.createElement(source.tagName); |
|
49 |
media.src = source.src; |
|
50 |
media.innerHTML = source.innerHTML; |
|
51 |
} |
|
52 |
else { |
|
53 |
// If the media element can't be found, leave it in to be resolved |
|
54 |
// by the user later. |
|
55 |
continue; |
|
56 |
} |
|
50 | 57 |
} |
51 | 58 |
|
52 | 59 |
// Apply attributes. |
... | ... | |
182 | 189 |
// media_get_file_without_label(). |
183 | 190 |
// |
184 | 191 |
// Finds the media-element class. |
185 |
var classRegex = 'class=([\'"])[^\\1]*?media-element';
|
|
192 |
var classRegex = 'class=[\'"][^\'"]*?media-element';
|
|
186 | 193 |
// Image tag with the media-element class. |
187 | 194 |
var regex = '<img[^>]+' + classRegex + '[^>]*?>'; |
188 | 195 |
// Or a span with the media-element class (used for documents). |
drupal7/sites/all/modules/media/modules/media_wysiwyg/js/media_wysiwyg.format_form.js | ||
---|---|---|
33 | 33 |
Drupal.media.formatForm.getOptions = function () { |
34 | 34 |
// Get all the values |
35 | 35 |
var ret = {}; |
36 |
// Keep track of multi-value fields. |
|
37 |
var fieldDelta = {}; |
|
36 | 38 |
|
37 | 39 |
$.each($('#media-wysiwyg-format-form .fieldset-wrapper *').serializeArray(), function (i, field) { |
40 |
|
|
41 |
// Support multi-value select lists, which show up here with [] at the end. |
|
42 |
if ('[]' == field.name.slice(-2)) { |
|
43 |
if (typeof fieldDelta[field.name] === 'undefined') { |
|
44 |
fieldDelta[field.name] = 0; |
|
45 |
} |
|
46 |
else { |
|
47 |
fieldDelta[field.name] += 1; |
|
48 |
} |
|
49 |
field.name = field.name.replace('[]', '[' + fieldDelta[field.name] + ']'); |
|
50 |
} |
|
51 |
|
|
38 | 52 |
ret[field.name] = field.value; |
39 | 53 |
|
40 | 54 |
// When a field uses a WYSIWYG format, the value needs to be extracted. |
drupal7/sites/all/modules/media/modules/media_wysiwyg/js/wysiwyg-media.js | ||
---|---|---|
41 | 41 |
invoke: function (data, settings, instanceId) { |
42 | 42 |
if (data.format == 'html') { |
43 | 43 |
var insert = new InsertMedia(instanceId); |
44 |
// CKEDITOR module support doesn't set this setting |
|
45 |
if (typeof settings['global'] === 'undefined') { |
|
46 |
settings['global'] = {id: 'media_wysiwyg'}; |
|
47 |
} |
|
44 | 48 |
if (this.isNode(data.node)) { |
45 | 49 |
// Change the view mode for already-inserted media. |
46 | 50 |
var media_file = Drupal.media.filter.extract_file_info($(data.node)); |
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.info | ||
---|---|---|
15 | 15 |
|
16 | 16 |
configure = admin/config/media/browser |
17 | 17 |
|
18 |
; Information added by Drupal.org packaging script on 2016-10-31
|
|
19 |
version = "7.x-2.0-beta5"
|
|
18 |
; Information added by Drupal.org packaging script on 2016-11-15
|
|
19 |
version = "7.x-2.0-beta7"
|
|
20 | 20 |
core = "7.x" |
21 | 21 |
project = "media" |
22 |
datestamp = "1477886358"
|
|
22 |
datestamp = "1479212995"
|
|
23 | 23 |
|
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.install | ||
---|---|---|
5 | 5 |
* Install, update and uninstall functions for the Media WYSIWYG module. |
6 | 6 |
*/ |
7 | 7 |
|
8 |
/** |
|
9 |
* Implements hook_install(). |
|
10 |
*/ |
|
11 |
function media_wysiwyg_install() { |
|
12 |
media_wysiwyg_update_7204(); |
|
13 |
} |
|
14 |
|
|
8 | 15 |
/** |
9 | 16 |
* Implements hook_uninstall(). |
10 | 17 |
*/ |
... | ... | |
17 | 24 |
variable_del('media_wysiwyg_wysiwyg_allowed_types'); |
18 | 25 |
variable_del('media_wysiwyg_wysiwyg_allowed_attributes'); |
19 | 26 |
variable_del('media_wysiwyg_wysiwyg_browser_plugins'); |
27 |
variable_del('media_wysiwyg_wysiwyg_override_field_types'); |
|
20 | 28 |
} |
21 | 29 |
|
22 | 30 |
/** |
... | ... | |
66 | 74 |
|
67 | 75 |
return $output; |
68 | 76 |
} |
77 |
/** |
|
78 |
* Whitelists certain fields for WYSIWYG overriding. |
|
79 |
*/ |
|
80 |
function media_wysiwyg_update_7204() { |
|
81 |
$instances = field_read_instances(array('entity_type' => 'file')); |
|
82 |
$updated = array(); |
|
83 |
$set_to_default = array(); |
|
84 |
foreach ($instances as $instance) { |
|
85 |
$field_info = field_info_field($instance['field_name']); |
|
86 |
$allowed_field_types = variable_get('media_wysiwyg_wysiwyg_override_field_types', array('text', 'text_long')); |
|
87 |
if (in_array($field_info['type'], $allowed_field_types)) { |
|
88 |
if (!isset($instance['settings']['wysiwyg_override'])) { |
|
89 |
$instance['settings']['wysiwyg_override'] = 1; |
|
90 |
field_update_instance($instance); |
|
91 |
$set_to_default[] = $instance['field_name']; |
|
92 |
} |
|
93 |
} |
|
94 |
elseif (isset($instance['settings']['wysiwyg_override'])) { |
|
95 |
unset($instance['settings']['wysiwyg_override']); |
|
96 |
field_update_instance($instance); |
|
97 |
$updated[] = $instance['field_name']; |
|
98 |
} |
|
99 |
} |
|
100 |
if (count($updated) || count($set_to_default)) { |
|
101 |
$updated_string = implode(', ', $updated); |
|
102 |
$default_string = implode(', ', $set_to_default); |
|
103 |
return t("Updated the following field instances: @updated_string so they can't be overridden when the file is inserted in the WYSIWYG. Updated the following fields @default_string so that they continue to show up when a file is inserted.", array( |
|
104 |
'@updated_string' => $updated_string, |
|
105 |
'@default_string' => $default_string, |
|
106 |
)); |
|
107 |
} |
|
108 |
} |
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.module | ||
---|---|---|
148 | 148 |
return $element; |
149 | 149 |
} |
150 | 150 |
|
151 |
/** |
|
152 |
* Implements hook_form_FORM_ID_alter(). |
|
153 |
*/ |
|
154 |
function media_wysiwyg_form_field_ui_field_edit_form_alter(&$form, &$form_state) { |
|
155 |
// Add a checkbox that marks this field as one that can be |
|
156 |
// overridden in the WYSIWYG. |
|
157 |
if ($form['#instance']['entity_type'] == 'file') { |
|
158 |
$field_type = $form['#field']['type']; |
|
159 |
$allowed_field_types = variable_get('media_wysiwyg_wysiwyg_override_field_types', array('text', 'text_long')); |
|
160 |
if (in_array($field_type, $allowed_field_types)) { |
|
161 |
$form['instance']['settings']['wysiwyg_override'] = array( |
|
162 |
'#type' => 'checkbox', |
|
163 |
'#title' => t('Override in WYSIWYG'), |
|
164 |
'#description' => t('If checked, then this field may be overridden in the WYSIWYG editor.'), |
|
165 |
'#default_value' => isset($form['#instance']['settings']['wysiwyg_override']) ? $form['#instance']['settings']['wysiwyg_override'] : FALSE, |
|
166 |
); |
|
167 |
} |
|
168 |
} |
|
169 |
} |
|
170 |
|
|
151 | 171 |
/** |
152 | 172 |
* Implements hook_form_FORM_ID_alter(). |
153 | 173 |
*/ |
... | ... | |
234 | 254 |
'#default_value' => variable_get('media_wysiwyg_wysiwyg_allowed_types', array('audio', 'image', 'video', 'document')), |
235 | 255 |
); |
236 | 256 |
|
257 |
$options = array(); |
|
258 |
foreach(field_info_field_types() as $key => $type) { |
|
259 |
$options[$key] = $type['label']; |
|
260 |
} |
|
261 |
asort($options); |
|
262 |
$form['wysiwyg']['media_wysiwyg_wysiwyg_override_field_types'] = array( |
|
263 |
'#type' => 'checkboxes', |
|
264 |
'#title' => t('Override field types in WYSIWYG'), |
|
265 |
'#options' => $options, |
|
266 |
'#default_value' => variable_get('media_wysiwyg_wysiwyg_override_field_types', array('text', 'text_long')), |
|
267 |
'#description' => t('If checked, then the field type may be overridden in the WYSIWYG editor. Not all field types (e.g. Term reference) currently support being overridden so the desired result might not be achieved.') |
|
268 |
); |
|
269 |
|
|
237 | 270 |
$form['#submit'][] = 'media_wysiwyg_admin_config_browser_pre_submit'; |
238 | 271 |
} |
239 | 272 |
|
... | ... | |
261 | 294 |
'tips callback' => 'media_filter_tips', |
262 | 295 |
); |
263 | 296 |
|
297 |
$filters['media_filter_paragraph_fix'] = array( |
|
298 |
'title' => t('Ensure that embedded Media tags are not contained in paragraphs'), |
|
299 |
'description' => t('This filter will strip any paragraph tags surrounding embedded Media tags. This helps to avoid the chopped up markup that can result from unexpectedly closed paragraph tags. This filter should be positioned above (before) the "Convert Media tags to markup" filter.'), |
|
300 |
'process callback' => 'media_wysiwyg_filter_paragraph_fix', |
|
301 |
'weight' => 1, |
|
302 |
); |
|
303 |
|
|
264 | 304 |
return $filters; |
265 | 305 |
} |
266 | 306 |
|
... | ... | |
308 | 348 |
* Optional custom settings can override how the file is displayed. |
309 | 349 |
*/ |
310 | 350 |
function media_wysiwyg_get_file_without_label($file, $view_mode, $settings = array(), $langcode = NULL) { |
351 |
// Get the override alt & title from the fields override array. Grab the |
|
352 |
// "special" field names from the token replacement in file_entity, then see |
|
353 |
// if an override is provided and needed. |
|
354 |
$pattern = '/\[(\w+):(\w+)\]/'; |
|
355 |
$alt = variable_get('file_entity_alt', '[file:field_file_image_alt_text]'); |
|
356 |
$title = variable_get('file_entity_title', '[file:field_file_image_title_text]'); |
|
357 |
$overrides = array( |
|
358 |
'alt' => $alt, |
|
359 |
'title' => $title, |
|
360 |
); |
|
361 |
foreach ($overrides as $field_type => $field_name) { |
|
362 |
preg_match($pattern, $field_name, $matches); |
|
363 |
if (!empty($matches[2])) { |
|
364 |
$field_name = $matches[2]; |
|
365 |
$langcode = field_language('file', $file, $field_name); |
|
366 |
if (isset($settings['fields'][$field_name][$langcode]['value'])) { |
|
367 |
if (empty($settings['attributes'][$field_type])) { |
|
368 |
$settings['attributes'][$field_type] = $settings['fields'][$field_name][$langcode]['value']; |
|
369 |
} |
|
370 |
} |
|
371 |
if (isset($settings['fields'][$field_name][$langcode][0]['value'])) { |
|
372 |
if (empty($settings['attributes'][$field_type])) { |
|
373 |
$settings['attributes'][$field_type] = $settings['fields'][$field_name][$langcode][0]['value']; |
|
374 |
} |
|
375 |
} |
|
376 |
} |
|
377 |
} |
|
378 |
|
|
311 | 379 |
$file->override = $settings; |
312 | 380 |
|
313 | 381 |
$element = file_view_file($file, $view_mode, $langcode); |
... | ... | |
447 | 515 |
drupal_alter('media_wysiwyg_wysiwyg_allowed_view_modes', $view_modes, $file); |
448 | 516 |
return $view_modes; |
449 | 517 |
} |
518 |
|
|
519 |
/** |
|
520 |
* Implements hook_file_displays_alter(). |
|
521 |
*/ |
|
522 |
function media_wysiwyg_file_displays_alter(&$displays, $file, $view_mode) { |
|
523 |
// Override the fields of the file when requested by the WYSIWYG. |
|
524 |
if (isset($file->override) && isset($file->override['fields'])) { |
|
525 |
$instance = field_info_instances('file', $file->type); |
|
526 |
foreach ($file->override['fields'] as $field_name => $value) { |
|
527 |
if (!isset($instance[$field_name]['settings']) || !isset($instance[$field_name]['settings']['wysiwyg_override']) || $instance[$field_name]['settings']['wysiwyg_override']) { |
|
528 |
$file->{$field_name} = $value; |
|
529 |
} |
|
530 |
} |
|
531 |
} |
|
532 |
} |
drupal7/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.info | ||
---|---|---|
5 | 5 |
dependencies[] = media_wysiwyg |
6 | 6 |
files[] = media_wysiwyg_view_mode.test |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2016-10-31
|
|
9 |
version = "7.x-2.0-beta5"
|
|
8 |
; Information added by Drupal.org packaging script on 2016-11-15
|
|
9 |
version = "7.x-2.0-beta7"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "media" |
12 |
datestamp = "1477886358"
|
|
12 |
datestamp = "1479212995"
|
|
13 | 13 |
|
drupal7/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.module | ||
---|---|---|
46 | 46 |
* Implements hook_form_FORM_ID_alter(). |
47 | 47 |
*/ |
48 | 48 |
function media_wysiwyg_view_mode_form_media_wysiwyg_format_form_alter(&$form, $form_state) { |
49 |
// Find the current selected view mode. |
|
49 |
// Check to see if a view mode ("format") has already been specified for |
|
50 |
// this media item. First, check for a standard form-submitted value. |
|
50 | 51 |
if (!empty($form_state['values']['format'])) { |
51 | 52 |
$view_mode = $form_state['values']['format']; |
52 | 53 |
} |
53 |
else { |
|
54 |
// Second, check the request for a JSON-encoded value. |
|
55 |
elseif (isset($_GET['fields'])) { |
|
56 |
$query_fields = drupal_json_decode($_GET['fields']); |
|
57 |
if (isset($query_fields['format'])) { |
|
58 |
$view_mode = $query_fields['format']; |
|
59 |
} |
|
60 |
} |
|
61 |
// If we were unable to determine a view mode, or we found a view mode |
|
62 |
// that does not exist in the list of format options presented on this |
|
63 |
// form, use the default view mode. |
|
64 |
if (!isset($view_mode) || !array_key_exists($view_mode, $form['options']['format']['#options'])) { |
|
54 | 65 |
$view_mode = $form['options']['format']['#default_value']; |
55 | 66 |
} |
56 | 67 |
|
drupal7/sites/all/modules/media/modules/mediafield/mediafield.info | ||
---|---|---|
4 | 4 |
core = 7.x |
5 | 5 |
dependencies[] = media |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2016-10-31
|
|
8 |
version = "7.x-2.0-beta5"
|
|
7 |
; Information added by Drupal.org packaging script on 2016-11-15
|
|
8 |
version = "7.x-2.0-beta7"
|
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "media" |
11 |
datestamp = "1477886358"
|
|
11 |
datestamp = "1479212995"
|
|
12 | 12 |
|
drupal7/sites/all/modules/media/tests/media_module_test.info | ||
---|---|---|
6 | 6 |
|
7 | 7 |
files[] = includes/MediaModuleTest.inc |
8 | 8 |
|
9 |
; Information added by Drupal.org packaging script on 2016-10-31
|
|
10 |
version = "7.x-2.0-beta5"
|
|
9 |
; Information added by Drupal.org packaging script on 2016-11-15
|
|
10 |
version = "7.x-2.0-beta7"
|
|
11 | 11 |
core = "7.x" |
12 | 12 |
project = "media" |
13 |
datestamp = "1477886358"
|
|
13 |
datestamp = "1479212995"
|
|
14 | 14 |
|
drupal7/sites/all/modules/media_ckeditor/README.txt | ||
---|---|---|
19 | 19 |
REQUIREMENTS |
20 | 20 |
------------ |
21 | 21 |
|
22 |
Media CKEditor has one dependency and needs three libraries.
|
|
22 |
Media CKEditor has two dependencies.
|
|
23 | 23 |
|
24 | 24 |
Contributed modules |
25 | 25 |
* CKEditor - The latest development release. |
26 |
* Media - 7.x-2.x - The Media WYSIWYG submodule. |
|
26 | 27 |
|
27 |
Libraries |
|
28 |
Additionally, the CKEditor library used by the CKEditor module must meet certain |
|
29 |
criteria and two plugins must be available. |
|
30 |
|
|
31 |
CKEditor Library |
|
28 | 32 |
* CKEditor - Version 4.3 or later. |
29 | 33 |
http://ckeditor.com/download |
34 |
|
|
35 |
CKEditor Library Plugins |
|
30 | 36 |
* CKEditor Line Utilities plugin - Compatible with the installed version of CKEditor. |
31 | 37 |
http://ckeditor.com/addon/lineutils |
32 | 38 |
* CKEditor Widget plugin - Compatible with the installed version of CKEditor. |
drupal7/sites/all/modules/media_ckeditor/js/media_ckeditor.format_form.js | ||
---|---|---|
1 |
/** |
|
2 |
* @file |
|
3 |
* Overrides of some functions in media and media_wysiwyg javascript. |
|
4 |
*/ |
|
5 |
|
|
6 |
(function ($) { |
|
7 |
|
|
8 |
// Sanity check, because javascript errors are bad. |
|
9 |
if (typeof Drupal.media === 'undefined' || |
|
10 |
typeof Drupal.media.formatForm === 'undefined') { |
|
11 |
return; |
|
12 |
} |
|
13 |
|
|
14 |
/** |
|
15 |
* This overrides, and is mostly a copy of, a function from the following file: |
|
16 |
* media/modules/media_wysiwyg/js/media_wysiwyg.format_form.js |
|
17 |
*/ |
|
18 |
Drupal.media.formatForm.getOptions = function () { |
|
19 |
// Get all the values |
|
20 |
var ret = {}; |
|
21 |
|
|
22 |
$.each($('#media-wysiwyg-format-form .fieldset-wrapper *').serializeArray(), function (i, field) { |
|
23 |
// For all fields, since they WILL be in JSON, encode them. |
|
24 |
ret[field.name] = encodeURIComponent(field.value); |
|
25 |
|
|
26 |
// When a field uses a WYSIWYG format, the value needs to be extracted. |
|
27 |
if (field.name.match(/\[format\]/i)) { |
|
28 |
field.name = field.name.replace(/\[format\]/i, '[value]'); |
|
29 |
field.key = 'edit-' + field.name.replace(/[_\[]/g, '-').replace(/[\]]/g, ''); |
|
30 |
|
|
31 |
if (typeof CKEDITOR !== 'undefined') { |
|
32 |
if (CKEDITOR.instances[field.key]) { |
|
33 |
ret[field.name] = CKEDITOR.instances[field.key].getData(); |
|
34 |
ret[field.name] = encodeURIComponent(ret[field.name]); |
|
35 |
} |
|
36 |
} |
|
37 |
} |
|
38 |
}); |
|
39 |
|
|
40 |
return ret; |
|
41 |
}; |
|
42 |
|
|
43 |
})(jQuery); |
drupal7/sites/all/modules/media_ckeditor/js/plugins/media/library.js | ||
---|---|---|
13 | 13 |
*/ |
14 | 14 |
invoke: function (data, settings, instanceId) { |
15 | 15 |
if (data.format == 'html') { |
16 |
// CKEDITOR module support doesn't set this setting |
|
17 |
if (typeof settings['global'] === 'undefined') { |
|
18 |
settings['global'] = {id: 'media_wysiwyg'}; |
|
19 |
} |
|
20 |
// If the selection is (or contains) an element with the attribute of |
|
21 |
// "data-media-element", assume the user wants to edit that thing. |
|
22 |
var $alreadyInsertedMedia; |
|
16 | 23 |
if (jQuery(data.node).is('[data-media-element]')) { |
24 |
$alreadyInsertedMedia = jQuery(data.node); |
|
25 |
} |
|
26 |
else { |
|
27 |
$alreadyInsertedMedia = jQuery(data.node).find('[data-media-element]'); |
|
28 |
} |
|
29 |
if ($alreadyInsertedMedia.length) { |
|
17 | 30 |
// Change the view mode for already-inserted media. |
18 |
var mediaFile = Drupal.media.filter.extract_file_info(jQuery(data.node));
|
|
31 |
var mediaFile = Drupal.media.filter.extract_file_info($alreadyInsertedMedia);
|
|
19 | 32 |
Drupal.media.popups.mediaStyleSelector(mediaFile, function (mediaFiles) { |
20 | 33 |
Drupal.settings.ckeditor.plugins['media'].insertMediaFile(mediaFile, mediaFiles, CKEDITOR.instances[instanceId]); |
21 | 34 |
}, settings['global']); |
... | ... | |
46 | 59 |
var element = Drupal.media.filter.create_element(formattedMedia.html, { |
47 | 60 |
fid: mediaFile.fid, |
48 | 61 |
view_mode: formattedMedia.type, |
49 |
attributes: formattedMedia.options |
|
62 |
attributes: mediaFile.attributes, |
|
63 |
fields: formattedMedia.options |
|
50 | 64 |
}); |
51 | 65 |
|
66 |
var hasWidgetSupport = typeof(CKEDITOR.plugins.registered.widget) != 'undefined'; |
|
67 |
|
|
52 | 68 |
// Use own wrapper element to be able to properly deal with selections. |
53 | 69 |
// Check prepareDataForWysiwygMode() in plugin.js for details. |
54 | 70 |
var wysiwygHTML = Drupal.media.filter.getWysiwygHTML(element); |
55 | 71 |
|
56 |
// Insert element. Use CKEDITOR.dom.element.createFromHtml to ensure our |
|
57 |
// custom wrapper element is preserved. |
|
58 | 72 |
if (wysiwygHTML.indexOf("<!--MEDIA-WRAPPER-START-") !== -1) { |
59 | 73 |
ckeditorInstance.plugins.media.mediaLegacyWrappers = true; |
60 | 74 |
wysiwygHTML = wysiwygHTML.replace(/<!--MEDIA-WRAPPER-START-(\d+)-->(.*?)<!--MEDIA-WRAPPER-END-\d+-->/gi, ''); |
61 |
} else { |
|
62 |
wysiwygHTML = '<mediawrapper data="">' + wysiwygHTML + '</mediawrapper>'; |
|
63 | 75 |
} |
64 | 76 |
|
77 |
// Insert element. Use CKEDITOR.dom.element.createFromHtml to ensure our |
|
78 |
// custom wrapper element is preserved. |
|
65 | 79 |
var editorElement = CKEDITOR.dom.element.createFromHtml(wysiwygHTML); |
66 | 80 |
ckeditorInstance.insertElement(editorElement); |
67 | 81 |
|
68 | 82 |
// Initialize widget on our html if possible. |
69 |
if (parseFloat(CKEDITOR.version) >= 4.3 && typeof(CKEDITOR.plugins.registered.widget) != 'undefined') {
|
|
83 |
if (parseFloat(CKEDITOR.version) >= 4.3 && hasWidgetSupport) {
|
|
70 | 84 |
ckeditorInstance.widgets.initOn( editorElement, 'mediabox' ); |
85 |
|
|
86 |
// Also support the image2 plugin. |
|
87 |
ckeditorInstance.widgets.initOn( editorElement, 'image' ); |
|
71 | 88 |
} |
72 | 89 |
}, |
73 | 90 |
|
drupal7/sites/all/modules/media_ckeditor/js/plugins/media/plugin.js | ||
---|---|---|
86 | 86 |
data = Drupal.media.filter.replaceTokenWithPlaceholder(data); |
87 | 87 |
// Legacy media wrapper. |
88 | 88 |
mediaPluginDefinition.mediaLegacyWrappers = (data.indexOf("<!--MEDIA-WRAPPER-START-") !== -1); |
89 |
data = data.replace(/<!--MEDIA-WRAPPER-START-(\d+)-->(.*?)<!--MEDIA-WRAPPER-END-\d+-->/gi, '<mediawrapper data="$1">$2</mediawrapper>'); |
|
89 |
if (mediaPluginDefinition.mediaLegacyWrappers) { |
|
90 |
data = data.replace(/<!--MEDIA-WRAPPER-START-(\d+)-->(.*?)<!--MEDIA-WRAPPER-END-\d+-->/gi, '<mediawrapper data="$1">$2</mediawrapper>'); |
|
91 |
} |
|
90 | 92 |
return data; |
91 | 93 |
} |
92 | 94 |
function prepareDataForSourceMode(data) { |
... | ... | |
95 | 97 |
if (mediaPluginDefinition.mediaLegacyWrappers) { |
96 | 98 |
replacement = '<!--MEDIA-WRAPPER-START-$1-->$2<!--MEDIA-WRAPPER-END-$1-->'; |
97 | 99 |
} |
98 |
data = data.replace(/<mediawrapper data="(.*)">(.*?)<\/mediawrapper>/gi, replacement); |
|
100 |
data = data.replace(/<mediawrapper data="(.*?)">(.*?)<\/mediawrapper>/gi, replacement);
|
|
99 | 101 |
data = Drupal.media.filter.replacePlaceholderWithToken(data); |
100 | 102 |
return data; |
101 | 103 |
} |
... | ... | |
106 | 108 |
editor.widgets.add( 'mediabox', |
107 | 109 |
{ |
108 | 110 |
button: 'Create a mediabox', |
109 |
template: '<mediawrapper></mediawrapper>', |
|
110 | 111 |
editables: {}, |
111 | 112 |
allowedContent: '*', |
112 | 113 |
upcast: function( element ) { |
113 |
if (element.name != 'mediawrapper') { |
|
114 |
// Ensure media tokens are converted to media placeholdes. |
|
115 |
element.setHtml(prepareDataForWysiwygMode(element.getHtml())); |
|
114 |
// Ensure media tokens are converted to media placeholders. |
|
115 |
html = Drupal.media.filter.replaceTokenWithPlaceholder(element.getHtml()); |
|
116 |
// Only replace html if it's different |
|
117 |
if (html != element.getHtml()) { |
|
118 |
element.setHtml(html); |
|
116 | 119 |
} |
117 |
return element.name == 'mediawrapper'; |
|
120 |
return element.name == 'mediawrapper' || 'data-media-element' in element.attributes;
|
|
118 | 121 |
}, |
119 | 122 |
|
120 | 123 |
downcast: function( widgetElement ) { |
121 |
var token = prepareDataForSourceMode(widgetElement.getOuterHtml()); |
|
122 |
return new CKEDITOR.htmlParser.text(token); |
|
123 |
return element.name == 'mediawrapper'; |
|
124 |
var token = Drupal.media.filter.replacePlaceholderWithToken(widgetElement.getOuterHtml()); |
|
125 |
if (token) { |
|
126 |
return new CKEDITOR.htmlParser.text(token); |
|
127 |
} |
|
128 |
return false; |
|
124 | 129 |
} |
125 | 130 |
}); |
126 | 131 |
} |
drupal7/sites/all/modules/media_ckeditor/media_ckeditor.info | ||
---|---|---|
8 | 8 |
|
9 | 9 |
test_dependencies[] = token |
10 | 10 |
|
11 |
; Information added by Drupal.org packaging script on 2015-08-12
|
|
12 |
version = "7.x-2.0-alpha1"
|
|
11 |
; Information added by Drupal.org packaging script on 2016-11-14
|
|
12 |
version = "7.x-2.0-alpha2"
|
|
13 | 13 |
core = "7.x" |
14 | 14 |
project = "media_ckeditor" |
15 |
datestamp = "1439391242"
|
|
15 |
datestamp = "1479125940"
|
|
16 | 16 |
|
drupal7/sites/all/modules/media_ckeditor/media_ckeditor.module | ||
---|---|---|
41 | 41 |
|
42 | 42 |
return $element; |
43 | 43 |
} |
44 |
|
|
45 |
/** |
|
46 |
* Implements hook_form_ID_alter(). |
|
47 |
*/ |
|
48 |
function media_ckeditor_form_media_wysiwyg_format_form_alter(&$form, $form_state) { |
|
49 |
// Add our overrides to the media format form javascript. |
|
50 |
$form['#attached']['js'][] = drupal_get_path('module', 'media_ckeditor') . '/js/media_ckeditor.format_form.js'; |
|
51 |
} |
|
52 |
|
|
53 |
/** |
|
54 |
* Implements hook_media_browser_params_alter(). |
|
55 |
*/ |
|
56 |
function media_ckeditor_media_browser_params_alter(&$stored_params) { |
|
57 |
// We add this custom param when the media dialog is invoked in library.js |
|
58 |
if (isset($stored_params['id']) && $stored_params['id'] == 'media_wysiwyg') { |
|
59 |
// Set the default browser params from settings form if not already set. |
|
60 |
if (empty($stored_params['enabledPlugins'])) { |
|
61 |
$stored_params['enabledPlugins'] = variable_get('media_wysiwyg_wysiwyg_browser_plugins', array()); |
|
62 |
} |
|
63 |
if (empty($stored_params['file_directory'])) { |
|
64 |
$stored_params['file_directory'] = variable_get('media_wysiwyg_wysiwyg_upload_directory', ''); |
|
65 |
} |
|
66 |
if (empty($stored_params['types'])) { |
|
67 |
$stored_params['types'] = variable_get('media_wysiwyg_wysiwyg_allowed_types', array('audio', 'image', 'video', 'document')); |
|
68 |
} |
|
69 |
} |
|
70 |
} |
|
71 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules