addlink_toolbar.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Plugin addlink_toolbar.
  4. * Adds the addlink input on the linklist page.
  5. */
  6. /**
  7. * When linklist is displayed, add play videos to header's toolbar.
  8. *
  9. * @param array $data - header data.
  10. *
  11. * @return mixed - header data with addlink toolbar item.
  12. */
  13. function hook_addlink_toolbar_render_header($data)
  14. {
  15. if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) {
  16. $form = array(
  17. 'attr' => array(
  18. 'method' => 'GET',
  19. 'action' => '',
  20. 'name' => 'addform',
  21. 'class' => 'addform',
  22. ),
  23. 'inputs' => array(
  24. array(
  25. 'type' => 'text',
  26. 'name' => 'post',
  27. 'placeholder' => t('URI'),
  28. ),
  29. array(
  30. 'type' => 'submit',
  31. 'value' => t('Add link'),
  32. 'class' => 'bigbutton',
  33. ),
  34. ),
  35. );
  36. $data['fields_toolbar'][] = $form;
  37. }
  38. return $data;
  39. }
  40. /**
  41. * This function is never called, but contains translation calls for GNU gettext extraction.
  42. */
  43. function addlink_toolbar_dummy_translation()
  44. {
  45. // meta
  46. t('Adds the addlink input on the linklist page.');
  47. }