Flarum\Event\ConfigureNotificationTypes::add PHP Method

add() public method

public add ( string $blueprint, string $serializer, array $enabledByDefault = [] )
$blueprint string
$serializer string
$enabledByDefault array
    public function add($blueprint, $serializer, $enabledByDefault = [])
    {
        if (!(new ReflectionClass($blueprint))->implementsInterface(BlueprintInterface::class)) {
            throw new InvalidArgumentException('Notification blueprint ' . $blueprint . ' must implement ' . BlueprintInterface::class);
        }
        $this->blueprints[$blueprint] = $enabledByDefault;
        $this->serializers[$blueprint::getType()] = $serializer;
    }

Usage Example

 /**
  * @param ConfigureNotificationTypes $event
  */
 public function registerNotificationType(ConfigureNotificationTypes $event)
 {
     $event->add(PostLikedBlueprint::class, PostBasicSerializer::class, ['alert']);
 }
All Usage Examples Of Flarum\Event\ConfigureNotificationTypes::add
ConfigureNotificationTypes