Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de l'espace de nommage Joomla\Component\Scheduler\Administrator\Traits

Fonctions

 startRoutine (ExecuteTaskEvent $event)
 
 endRoutine (ExecuteTaskEvent $event, int $exitCode)
 
 advertiseRoutines (EventInterface $event)
 
 getRoutineId (Form $form, $data)
 
 logTask (string $message, string $priority='info')
 
 standardRoutineHandler (ExecuteTaskEvent $event)
 

Variables

trait TaskPluginTrait
 

Documentation des fonctions

◆ advertiseRoutines()

Joomla\Component\Scheduler\Administrator\Traits\advertiseRoutines ( EventInterface  $event)

Advertise the task routines supported by the plugin. This method should be mapped to the onTaskOptionsList, enabling the plugin to advertise its routines without any custom logic.
Note: This method expects the TASKS_MAP class constant to have relevant information.

Paramètres
EventInterface$eventonTaskOptionsList Event
Renvoie
void
Depuis
4.1.0

Références $options, $subject, et EventInterface\getArgument().

◆ endRoutine()

Joomla\Component\Scheduler\Administrator\Traits\endRoutine ( ExecuteTaskEvent  $event,
int  $exitCode 
)
protected

Set information to {

Voir également
$snapshot} when ending a routine. This information includes the routine exit code and timing information.
Paramètres
ExecuteTaskEvent$eventThe event
?int$exitCode The task exit code
Renvoie
void
Depuis
4.1.0
Exceptions

Références $this, Status\OK, et ExecuteTaskEvent\setResult().

Référencé par SiteStatus\alterSiteStatus(), et Joomla\Component\Scheduler\Administrator\Traits\standardRoutineHandler().

◆ getRoutineId()

Joomla\Component\Scheduler\Administrator\Traits\getRoutineId ( Form  $form,
  $data 
)
protected

Get the relevant task routine ID in the context of a form event, e.g., the onContentPrepareForm event.

Paramètres
Form$formThe form
mixed$dataThe data
Renvoie
string
Depuis
4.1.0
Exceptions

Références $app, $data, $form, Factory\getApplication(), et ArrayHelper\getValue().

◆ logTask()

Joomla\Component\Scheduler\Administrator\Traits\logTask ( string  $message,
string  $priority = 'info' 
)
protected

◆ standardRoutineHandler()

Joomla\Component\Scheduler\Administrator\Traits\standardRoutineHandler ( ExecuteTaskEvent  $event)

Handler for standard task routines. Standard routines are mapped to valid class methods 'method' through static::TASKS_MAP. These methods are expected to take a single argument (the Event) and return an integer return status (see {

Voir également
Status}). For a plugin that maps each of its task routines to valid methods and does not need non-standard handling, this method can be mapped to the onExecuteTask event through {
SubscriberInterface::getSubscribedEvents()}, which would allow it to then check if the event wants to execute a routine offered by the parent plugin, call the routine and do some other housework without any code in the parent classes.
Compatible routine method signature:   ({
ExecuteTaskEvent::class}, ...): int
Paramètres
ExecuteTaskEvent$eventThe onExecuteTask event.
Renvoie
void
Depuis
4.1.0
Exceptions

Closure to validate a status against {

Voir également
Status}
Depuis
4.1.0

Références $method, $methodName, Symfony\Component\Console\Tester\$statusCode, $this, class, Joomla\Component\Scheduler\Administrator\Traits\endRoutine(), ExecuteTaskEvent\getRoutineId(), Status\INVALID_EXIT, Joomla\Component\Scheduler\Administrator\Traits\logTask(), Status\NO_EXIT, Status\NO_RUN, et Joomla\Component\Scheduler\Administrator\Traits\startRoutine().

◆ startRoutine()

Joomla\Component\Scheduler\Administrator\Traits\startRoutine ( ExecuteTaskEvent  $event)
protected

Set information to {

Voir également
$snapshot} when initializing a routine.
Paramètres
ExecuteTaskEvent$eventThe onExecuteTask event.
Renvoie
void
Depuis
4.1.0

Références $this, AbstractEvent\getArgument(), et Status\RUNNING.

Référencé par SiteStatus\alterSiteStatus(), et Joomla\Component\Scheduler\Administrator\Traits\standardRoutineHandler().

Documentation des variables

◆ TaskPluginTrait

trait TaskPluginTrait
Valeur initiale :
{
protected $snapshot = []

Utility trait for plugins that offer com_scheduler compatible task routines. This trait defines a lot of handy methods that make it really simple to support task routines in a J4.x plugin. This trait includes standard methods to broadcast routines {

Voir également
TaskPluginTrait::advertiseRoutines()}, enhance task forms {
TaskPluginTrait::enhanceTaskItemForm()} and call routines {
TaskPluginTrait::standardRoutineHandler()}. With standard cookie-cutter behaviour, a task plugin may only need to include this trait, and define methods corresponding to each routine along with the TASKS_MAP class constant to declare supported routines and related properties.
Depuis
4.1.0