]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | /** | |
3 | * Plugin PlayVideos | |
4 | * | |
5 | * Add a button in the toolbar allowing to watch all videos. | |
6 | * Note: this plugin adds jQuery. | |
7 | */ | |
8 | ||
9 | /** | |
10 | * When linklist is displayed, add play videos to header's toolbar. | |
11 | * | |
12 | * @param array $data - header data. | |
13 | * | |
14 | * @return mixed - header data with playvideos toolbar item. | |
15 | */ | |
16 | function hook_playvideos_render_header($data) | |
17 | { | |
18 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { | |
19 | $playvideo = array( | |
20 | 'attr' => array( | |
21 | 'href' => '#', | |
22 | 'title' => t('Video player'), | |
23 | 'id' => 'playvideos', | |
24 | ), | |
25 | 'html' => '► '. t('Play Videos') | |
26 | ); | |
27 | $data['buttons_toolbar'][] = $playvideo; | |
28 | } | |
29 | ||
30 | return $data; | |
31 | } | |
32 | ||
33 | /** | |
34 | * When linklist is displayed, include playvideos JS files. | |
35 | * | |
36 | * @param array $data - footer data. | |
37 | * | |
38 | * @return mixed - footer data with playvideos JS files added. | |
39 | */ | |
40 | function hook_playvideos_render_footer($data) | |
41 | { | |
42 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { | |
43 | $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/playvideos/jquery-1.11.2.min.js'; | |
44 | $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/playvideos/youtube_playlist.js'; | |
45 | } | |
46 | ||
47 | return $data; | |
48 | } | |
49 | ||
50 | /** | |
51 | * This function is never called, but contains translation calls for GNU gettext extraction. | |
52 | */ | |
53 | function playvideos_dummy_translation() | |
54 | { | |
55 | // meta | |
56 | t('Add a button in the toolbar allowing to watch all videos.'); | |
57 | } |