playvideos.php 1.4 KB

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