This commit is contained in:
Jun Pataleta 2024-04-17 23:42:22 +08:00
commit 9966241efb
No known key found for this signature in database
GPG key ID: F83510526D99E2C7
35 changed files with 127 additions and 204 deletions

View file

@ -30,13 +30,13 @@ use stdClass;
#[\core\attribute\label('Allows plugins or features to perform actions after a course is created.')]
#[\core\attribute\tags('course')]
class after_course_created {
/**
* Constructor for the hook.
*
* @param stdClass $course The course instance.
*/
public function __construct(
/** @var stdClass The course instance */
public readonly stdClass $course,
) {
}

View file

@ -28,7 +28,6 @@ use stdClass;
#[\core\attribute\label('Allows plugins or features to perform actions after a course is updated.')]
#[\core\attribute\tags('course')]
class after_course_updated {
/**
* Constructor for the hook.
*
@ -37,8 +36,11 @@ class after_course_updated {
* @param bool $changeincoursecat Whether the course category has changed.
*/
public function __construct(
/** @var stdClass The course instance */
public readonly stdClass $course,
/** @var stdClass The old course instance */
public readonly stdClass $oldcourse,
/** @var bool Whether the course category has changed */
public readonly bool $changeincoursecat = false,
) {
}

View file

@ -28,13 +28,10 @@ use Psr\EventDispatcher\StoppableEventInterface;
*/
#[\core\attribute\label('Allows plugins or features to perform actions before a course is deleted.')]
#[\core\attribute\tags('course')]
class before_course_delete implements
StoppableEventInterface {
/**
* @var bool Whether the propagation of this event has been stopped.
*/
protected bool $stopped = false;
class before_course_deleted implements
StoppableEventInterface
{
use \core\hook\stoppable_trait;
/**
* Constructor for the hook.
@ -42,18 +39,8 @@ class before_course_delete implements
* @param stdClass $course The course instance.
*/
public function __construct(
/** @var stdClass The course instance */
public readonly stdClass $course,
) {
}
public function isPropagationStopped(): bool {
return $this->stopped;
}
/**
* Stop the propagation of this event.
*/
public function stop(): void {
$this->stopped = true;
}
}

View file

@ -34,7 +34,9 @@ class after_cm_name_edited implements described_hook {
* @param string $newname the new name
*/
public function __construct(
/** @var cm_info the course module */
protected cm_info $cm,
/** @var string the new name */
protected string $newname,
) {
}