toolbar_entry.phtml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. // @codingStandardsIgnoreFile
  7. ?>
  8. <?php /** @var $this \Magento\AdminNotification\Block\ToolbarEntry */ ?>
  9. <?php
  10. $notificationCount = $block->getUnreadNotificationCount();
  11. $notificationCounterMax = $block->getNotificationCounterMax();
  12. ?>
  13. <div
  14. data-mage-init='{"toolbarEntry": {}}'
  15. class="notifications-wrapper admin__action-dropdown-wrap"
  16. data-notification-count="<?= /* @escapeNotVerified */ $notificationCount ?>">
  17. <?php if ($notificationCount > 0) : ?>
  18. <a
  19. href="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/notification/index') ?>"
  20. class="notifications-action admin__action-dropdown"
  21. data-mage-init='{"dropdown":{}}'
  22. title="<?= /* @escapeNotVerified */ __('Notifications') ?>"
  23. data-toggle="dropdown">
  24. <span class="notifications-counter">
  25. <?= /* @escapeNotVerified */ ($notificationCount > $notificationCounterMax) ? $notificationCounterMax . '+' : $notificationCount ?>
  26. </span>
  27. </a>
  28. <ul
  29. class="admin__action-dropdown-menu"
  30. data-mark-as-read-url="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/notification/ajaxMarkAsRead') ?>">
  31. <?php foreach ($block->getLatestUnreadNotifications() as $notification) : ?>
  32. <?php /** @var $notification \Magento\AdminNotification\Model\Inbox*/ ?>
  33. <li class="notifications-entry<?php if ($notification->getSeverity() == 1): ?> notifications-critical<?php endif; ?>"
  34. data-notification-id="<?= /* @escapeNotVerified */ $notification->getId() ?>"
  35. data-notification-severity="<?php if ($notification->getSeverity() == 1): ?>1<?php endif; ?>">
  36. <?php
  37. $notificationDescription = $block->escapeHtml($notification->getDescription());
  38. $notificationDescriptionLength = $block->getNotificationDescriptionLength();
  39. ?>
  40. <strong class="notifications-entry-title">
  41. <?= $block->escapeHtml($notification->getTitle()) ?>
  42. </strong>
  43. <?php if (strlen($notificationDescription) > $notificationDescriptionLength) : ?>
  44. <p class="notifications-entry-description _cutted">
  45. <span class="notifications-entry-description-start">
  46. <?= /* @escapeNotVerified */ substr($notificationDescription, 0, $notificationDescriptionLength) ?>
  47. </span>
  48. <span class="notifications-entry-description-end">
  49. <?= /* @escapeNotVerified */ substr($notificationDescription, $notificationDescriptionLength) ?>
  50. </span>
  51. </p>
  52. <?php else : ?>
  53. <p class="notifications-entry-description">
  54. <?= /* @escapeNotVerified */ $notificationDescription ?>
  55. </p>
  56. <?php endif; ?>
  57. <time class="notifications-entry-time">
  58. <?= /* @escapeNotVerified */ $block->formatNotificationDate($notification->getDateAdded()) ?>
  59. </time>
  60. <button
  61. type="button"
  62. class="notifications-close"
  63. title="<?= /* @escapeNotVerified */ __('Close') ?>"
  64. ></button>
  65. </li>
  66. <?php endforeach; ?>
  67. <li class="notifications-entry notifications-entry-last">
  68. <a
  69. href="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/notification/index') ?>"
  70. class="action-tertiary action-more">
  71. <?= /* @escapeNotVerified */ __('See All (') ?><span class="notifications-counter"><?= /* @escapeNotVerified */ $notificationCount ?></span><?= /* @escapeNotVerified */ __(' unread)') ?>
  72. </a>
  73. </li>
  74. </ul>
  75. <?php else : ?>
  76. <a
  77. class="notifications-action admin__action-dropdown"
  78. href="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/notification/index') ?>"
  79. title="<?= /* @escapeNotVerified */ __('Notifications') ?>">
  80. </a>
  81. <?php endif; ?>
  82. </div>