Witam chciałem umieścić w pliku like button ale nie mam pojecia jak go wkleić. Chodzi o button do polubienia posta i wstawic po embed buttonem

  1. <?php
  2.  
  3. class WPictureShareMenu extends UMenuWorklet {
  4.  
  5. public $space = 'outside';
  6. public $post;
  7.  
  8. public function taskConfig() {
  9. if (!$this->post)
  10. return $this->show = false;
  11. parent::taskConfig();
  12. }
  13.  
  14. public function taskItems() {
  15. $items = array();
  16. $items[] = array('label' => $this->t('Embed'), 'url' => url('/picture/share/embed', array('post' => $this->post->id)),
  17. 'itemOptions' => array('class' => 'embedButton'),
  18. 'linkOptions' => array('class' => 'uDialog'));
  19.  
  20. $items[] = array('label' => $this->t('Report {#post_n}'), 'url' => url('/picture/share/report', array('post' => $this->post->id)),
  21. 'itemOptions' => array('class' => 'reportButton'),
  22. 'linkOptions' => array('class' => 'uDialog'));
  23.  
  24. $items[] = array('label' => $this->t('Email'), 'url' => url('/picture/share/email', array('post' => $this->post->id)),
  25. 'itemOptions' => array('class' => 'emailButton'),
  26. 'linkOptions' => array('class' => 'uDialog'),
  27. 'visible' => !app()->user->isGuest);
  28.  
  29. $items[] = array('label' => $this->t('Delete Post'), 'url' => url('/picture/delete', array('id' => $this->post->id)),
  30. 'visible' => app()->user->checkAccess('administrator'),
  31. 'linkOptions' => array('class' => 'delete'));
  32.  
  33. $items[] = array('label' => $this->t('Delete Picture'), 'url' => url('/picture/admin/deleteAll', array('id' => $this->post->pictureId)),
  34. 'visible' => app()->user->checkAccess('administrator'),
  35. 'linkOptions' => array('class' => 'delete'));
  36.  
  37. return $items;
  38. }
  39.  
  40. public function properties() {
  41. return array('items' => $this->items());
  42. }
  43.  
  44. public function afterRenderOutput()
  45. {
  46. cs()->registerScript(__CLASS__,'jQuery(".delete").click(function(){
  47. if(confirm("'.$this->t('Are you sure?').'"))
  48. {
  49. $.ajax({
  50. url: $(this).attr("href"),
  51. success: function(data){
  52. window.location = "'.url('/').'";
  53. }
  54. });
  55. }
  56. return false;
  57. });');
  58. }
  59.  
  60. }