1. YoureCom
    1. About me
  2. Work Place
  3. Support
  4. Work Place
  • Login
  • Register
  • Search
Clan Management: Boards
  • Everywhere
  • Clan Management: Boards
  • Clan Management: Boards
  • Pages
  • Forum
  • Tasks
  • Products
  • More Options
  1. YoureCom - Plugins for the WoltLab Suite Core (WSC)
  2. Workplace
  3. Clan Management
  4. Clan Management: Boards

Revision of own events #171

  • Marcel Beckers
  • January 15, 2023 at 12:49 PM
  • 0 Comments
  • Undone
  • Overview

Events should be adjusted

Bislang:

Code
$parameters = [
    'value' => \random_int(1, 1024),
];

EventHandler::getInstance()->fireAction($this, 'valueAvailable', $parameters);
PHP
<?php

namespace wcf\system\event\listener;

use wcf\form\ValueForm;

final class ValueDumpListener implements IParameterizedEventListener
{
    /**
     * @inheritDoc
     * @param ValueForm $eventObj
     */
    public function execute($eventObj, $className, $eventName, array &$parameters)
    {
        var_dump($parameters['value']);
    }
}
Display More

Absofort

Code
EventHandler::getInstance()->fire(new ValueAvailable(\random_int(1, 1024)));
PHP
<?php

namespace wcf\system\foo\event;

use wcf\system\event\IEvent;

final class ValueAvailable implements IEvent
{
    /**
     * @var int
     */
    private $value;

    public function __construct(int $value)
    {
        $this->value = $value;
    }

    public function getValue(): int
    {
        return $this->value;
    }
}
Display More
  • Share

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!

Register Yourself Login

Last completed Tasks

  1. Revision of own events Guestbook

    Marcel Beckers January 15, 2023 at 12:49 PM
  2. Revision of own events Workplace

    Marcel Beckers January 15, 2023 at 12:49 PM
  3. PHP Database API Post

    Marcel Beckers January 15, 2023 at 12:33 PM
  4. Replacement of HeaderUtil::redirect Clan Management

    Marcel Beckers January 15, 2023 at 12:40 PM
  5. Implementation of the Infraction System Clan Management

    Marcel Beckers December 15, 2021 at 4:12 PM
  6. Implementation of the Infraction System Competitions Based System

    Marcel Beckers December 15, 2021 at 4:09 PM
  1. Contact
  2. Privacy Policy
  3. Legal Notice
  4. Terms and Conditions (T&C)
Workplace
Powered by WoltLab Suite™
Design by DragNord.com