Skip to content
Snippets Groups Projects
Commit 32673fc1 authored by Bram Driesen's avatar Bram Driesen
Browse files

Merge branch '3336339-cleaned' into '2.0.x'

feat: Commit patch

See merge request !20
parents 78cbfdcc 19ae3c57
No related branches found
No related tags found
No related merge requests found
Pipeline #98896 passed with warnings
......@@ -71,7 +71,8 @@ Submit bug reports and feature suggestions, or track changes in the
Block Layout
- Notification widget block
4. Service provided to add any new notification message using below sample code :
4. Service provided to add any new notification message using
below sample code :
```php
/**
......@@ -93,13 +94,17 @@ Submit bug reports and feature suggestions, or track changes in the
* The entity that led to the notification being triggered.
* Used to replace tokens in the message content.
* @param int|null $recipient_uid
* (optional): The ID of the user to whom the notification should be sent. If NULL, then further logic will be
* (optional): The ID of the user to whom the notification should be sent.
* If NULL, then further logic will be
* applied to calculate the recipient.
* @param int|null $operator_uid
* (optional): The ID of the user who performed the action on the entity. If NULL, then the current user will be
* (optional): The ID of the user who performed the action on the entity.
* If NULL, then the current user will be
* assumed.
*/
public function logNotification(array $message, string $userAction, object $entity, int $recipient_uid = NULL, int $operator_uid = NULL): void;
public function logNotification(array $message, string $userAction,
object $entity,
int $recipient_uid = NULL, int $operator_uid = NULL): void;
```
Example usage:
......
......@@ -5,8 +5,8 @@
* Install, update and uninstall functions for the notification module module.
*/
use Drupal\Core\Url;
use Drupal\Core\Database\Database;
use Drupal\Core\Url;
/**
* Implements hook_schema().
......
......@@ -5,8 +5,8 @@
* Contains notifications_widget.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
/**
......@@ -278,8 +278,8 @@ function notifications_widget_views_data() {
],
];
$data['notifications']['bundle'] = [
'title' => t('Notification entity\'s bundles'),
'help' => t('Display name of entity\'s bundles.'),
'title' => t("Notification entity\'s bundles"),
'help' => t("Display name of entity\'s bundles."),
'field' => [
'id' => 'markup',
'format' => 'full_html',
......
......@@ -3,13 +3,13 @@
namespace Drupal\notifications_widget\Form;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides settings for Activity tracking module.
......
......@@ -3,12 +3,12 @@
namespace Drupal\notifications_widget\Form;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides settings for Notification widget module.
......@@ -272,9 +272,9 @@ class NotificationsWidgetSettingsForm extends ConfigFormBase {
$form[$nodeType][$contentTypeEnable] = [
'#type' => 'checkboxes',
'#options' => [
'Create' => 'Create',
'Update' => 'Update',
'Delete' => 'Delete',
'Create' => $this->t('Create'),
'Update' => $this->t('Update'),
'Delete' => $this->t('Delete'),
],
'#title' => 'Notification logs enable',
'#default_value' => $contentDefaultValues,
......
......@@ -2,14 +2,14 @@
namespace Drupal\notifications_widget\Plugin\Block;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Database\Connection;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides a block with list of notification items.
......
......@@ -3,14 +3,14 @@
namespace Drupal\notifications_widget\Plugin\rest\resource;
use Drupal\Component\Serialization\Json;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\Core\Database\Connection;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Psr\Log\LoggerInterface;
/**
* Provides a resource to get update the status of notification items.
......
......@@ -2,14 +2,14 @@
namespace Drupal\notifications_widget\Services;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Session\AccountProxy;
use Symfony\Component\HttpFoundation\RequestStack;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Session\AccountProxy;
use Drupal\Core\Utility\Token;
use Drupal\Component\Datetime\TimeInterface;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* Service handler for Notification Logger.
......
......@@ -26,10 +26,12 @@ interface NotificationsWidgetServiceInterface {
* The entity that led to the notification being triggered.
* Used to replace tokens in the message content.
* @param int|null $recipient_uid
* (optional): The ID of the user to whom the notification should be sent. If NULL, then further logic will be
* (optional): The ID of the user to whom the notification should be sent.
* If NULL, then further logic will be
* applied to calculate the recipient.
* @param int|null $operator_uid
* (optional): The ID of the user who performed the action on the entity. If NULL, then the current user will be
* (optional): The ID of the user who performed the action on the entity.
* If NULL, then the current user will be
* assumed.
*/
public function logNotification(array $message, string $userAction, object $entity, int $recipient_uid = NULL, int $operator_uid = NULL): void;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment