[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_scheduler/src/Traits/ -> TaskPluginTrait.php (summary)

(no description)

Copyright: (C) 2021 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 337 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 7 functions

  startRoutine()
  endRoutine()
  enhanceTaskItemForm()
  advertiseRoutines()
  getRoutineId()
  logTask()
  standardRoutineHandler()

Functions
Functions that are not part of a class:

startRoutine(ExecuteTaskEvent $event)   X-Ref
Set information to {@see $snapshot} when initializing a routine.

param: ExecuteTaskEvent  $event  The onExecuteTask event.
return: void

endRoutine(ExecuteTaskEvent $event, int $exitCode)   X-Ref
Set information to {@see $snapshot} when ending a routine. This information includes the routine exit code and
timing information.

param: ExecuteTaskEvent  $event     The event
param: ?int              $exitCode  The task exit code
return: void

enhanceTaskItemForm($context, $data = null)   X-Ref
Enhance the task form with routine-specific fields from an XML file declared through the TASKS_MAP constant.
If a plugin only supports the task form and does not need additional logic, this method can be mapped to the
`onContentPrepareForm` event through {@see SubscriberInterface::getSubscribedEvents()} and will take care
of injecting the fields without additional logic in the plugin class.

param: EventInterface|Form  $context  The onContentPrepareForm event or the Form object.
param: mixed                $data     The form data, required when $context is a {@see Form} instance.
return: boolean  True if the form was successfully enhanced or the context was not relevant.

advertiseRoutines(EventInterface $event)   X-Ref
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.<br/>
**Note:** This method expects the `TASKS_MAP` class constant to have relevant information.

param: EventInterface  $event  onTaskOptionsList Event
return: void

getRoutineId(Form $form, $data)   X-Ref
Get the relevant task routine ID in the context of a form event, e.g., the `onContentPrepareForm` event.

param: Form   $form  The form
param: mixed  $data  The data
return: string

logTask(string $message, string $priority = 'info')   X-Ref
Add a log message to the task log.

param: string  $message   The log message
param: string  $priority  The log message priority
return: void

standardRoutineHandler(ExecuteTaskEvent $event)   X-Ref
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 {@see 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
{@see 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.<br/>
**Compatible routine method signature:**&nbsp;&nbsp; ({@see ExecuteTaskEvent::class}, ...): int

param: ExecuteTaskEvent  $event  The `onExecuteTask` event.
return: void



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer