Projet

Général

Profil

Paste
Télécharger (907 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / media_ckeditor / media_ckeditor.module @ 0ccfec7f

1
<?php
2

    
3
/**
4
 * @file
5
 * Primarily Drupal hooks.
6
 */
7

    
8
/**
9
 * Implements hook_element_info_alter().
10
 */
11
function media_ckeditor_element_info_alter(&$types) {
12
  $types['text_format']['#pre_render'][] = 'media_ckeditor_pre_render_text_format';
13
}
14

    
15
/**
16
 * Adds CKEditor-specific JavaScript.
17
 */
18
function media_ckeditor_pre_render_text_format($element) {
19
  // filter_process_format() copies properties to the expanded 'value' child
20
  // element.
21
  if (!isset($element['format'])) {
22
    return $element;
23
  }
24

    
25
  $field = &$element['value'];
26
  $settings = array(
27
    'field' => $field['#id'],
28
  );
29

    
30
  if (!isset($field['#value'])) {
31
    return $element;
32
  }
33

    
34
  // Add CKEditor-specific JS.
35
  $element['#attached']['js'][] = array(
36
    'data' => drupal_get_path('module', 'media_ckeditor') . '/js/plugins/media/library.js',
37
    'type' => 'file',
38
    'scope' => 'footer',
39
    'weight' => -20,
40
  );
41

    
42
  return $element;
43
}