playvideos.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. $data['buttons_toolbar'][] = file_get_contents(PluginManager::$PLUGINS_PATH . '/playvideos/playvideos.html');
  19. }
  20. return $data;
  21. }
  22. /**
  23. * When linklist is displayed, include playvideos JS files.
  24. *
  25. * @param array $data - footer data.
  26. *
  27. * @return mixed - footer data with playvideos JS files added.
  28. */
  29. function hook_playvideos_render_footer($data)
  30. {
  31. if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) {
  32. $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/playvideos/jquery-1.11.2.min.js';
  33. $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/playvideos/youtube_playlist.js';
  34. }
  35. return $data;
  36. }