HookNotificationTitle.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This file contains the Hook Event class for Title of Notifications
  5. * @package chamilo.library.hook
  6. */
  7. /**
  8. * Class HookNotificationTitle
  9. */
  10. class HookNotificationTitle extends HookEvent implements HookNotificationTitleEventInterface
  11. {
  12. /**
  13. * Construct
  14. */
  15. protected function __construct()
  16. {
  17. parent::__construct('HookNotificationTitle');
  18. }
  19. /**
  20. * @param int $type
  21. *
  22. * @return array|null
  23. */
  24. public function notifyNotificationTitle($type)
  25. {
  26. /** @var \HookNotificationTitleObserverInterface $observer */
  27. // Check if exists data title
  28. if (isset($this->eventData['title'])) {
  29. // Save data type
  30. $this->eventData['type'] = $type;
  31. // Check for hook all registered observers
  32. foreach ($this->observers as $observer) {
  33. // Get data from hook observer
  34. $data = $observer->hookNotificationTitle($this);
  35. // Check if isset data title
  36. if (isset($data['title'])) {
  37. // Set data from hook observer data
  38. $this->setEventData($data);
  39. }
  40. }
  41. return $this->eventData;
  42. }
  43. return null;
  44. }
  45. }