forked from ding2/ding_content
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathding_content.module
More file actions
153 lines (140 loc) · 3.99 KB
/
ding_content.module
File metadata and controls
153 lines (140 loc) · 3.99 KB
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
include_once('ding_content.features.inc');
/**
* @file
* Various integration with panels to create panel panes and more.
*/
/**
* Implements hook_menu().
*/
function ding_content_menu() {
$items = array();
$items['ding_content/media'] = array(
'title' => 'Media browser list',
'description' => 'Ajax Callback for getting media',
'page callback' => 'ding_content_media_browser_list',
'access callback' => 'media_access',
'access arguments' => array('view'),
'type' => MENU_CALLBACK,
'file' => 'ding_content.admin.inc',
);
return $items;
}
/**
* Implements hook_enable().
*
* Create taxonomy vocabolary if needed.
*/
function ding_content_enable() {
// Create wysiwyg profile if needed.
if (!wysiwyg_profile_load('ding_wysiwyg')) {
$wysiwyg = array(
'format' => 'ding_wysiwyg',
'editor' => 'ckeditor',
'settings' => array(
'default' => 1,
'user_choose' => 0,
'show_toggle' => 1,
'theme' => 'advanced',
'buttons' => array(
'default' => array(
'Bold' => 1,
'Italic' => 1,
'Underline' => 1,
'JustifyLeft' => 1,
'JustifyCenter' => 1,
'JustifyRight' => 1,
'BulletedList' => 1,
'NumberedList' => 1,
'Undo' => 1,
'Redo' => 1,
'Link' => 1,
'Unlink' => 1,
'Anchor' => 1,
'TextColor' => 1,
'BGColor' => 1,
'Blockquote' => 1,
'Cut' => 1,
'Copy' => 1,
'Paste' => 1,
'PasteText' => 1,
'PasteFromWord' => 1,
'RemoveFormat' => 1,
'Format' => 1,
'Font' => 1,
'FontSize' => 1,
'Styles' => 1,
'Table' => 1,
'CreateDiv' => 1,
),
'drupal' => array(
'media' => 1,
),
),
'toolbar_loc' => 'top',
'toolbar_align' => 'left',
'path_loc' => 'bottom',
'resizing' => 1,
'verify_html' => 1,
'preformatted' => 0,
'convert_fonts_to_spans' => 1,
'remove_linebreaks' => 1,
'apply_source_formatting' => 0,
'paste_auto_cleanup_on_paste' => 0,
'block_formats' => 'p,address,pre,h2,h3,h4,h5,h6,div',
'css_setting' => 'theme',
'css_path' => '',
'css_classes' => '',
),
);
$wysiwyg['settings'] = serialize($wysiwyg['settings']);
drupal_write_record('wysiwyg', $wysiwyg);
wysiwyg_profile_cache_clear();
}
}
/**
* Implements hook_media_browser_plugin_info().
*/
function ding_content_media_browser_plugin_info() {
$plugins = array();
$plugins['ding_content'] = array(
'#weight' => 0,
);
return $plugins;
}
/**
* Implements hook_media_browser_plugin_view().
*/
function ding_content_media_browser_plugin_view($plugin_name, $params) {
$media_path = drupal_get_path('module', 'media');
$path = drupal_get_path('module', 'ding_content');
$params += array(
'types' => array(),
'multiselect' => FALSE,
);
switch ($plugin_name) {
case 'ding_content':
return array(
'#title' => t('Personal library'),
'#attached' => array(
'js' => array(
$media_path . '/js/plugins/media.library.js',
$path . '/js/ding_content.media.js',
),
'css' => array(
//@todo: should move this.
$media_path . '/js/plugins/media.library.css',
$path . '/css/ding_content.media.css',
),
),
'#settings' => array(
'viewMode' => 'thumbnails',
'getMediaUrl' => url('ding_content/media'),
// We should probably change this to load dynamically when requested
// via the JS file.
) + $params,
'#markup' => '<div id="container"><div id="scrollbox"><ul id="media-browser-library-list" class="media-list-thumbnails"></ul><div id="status"></div></div></div>',
);
}
return array();
}