- md5
- 539bb9a9c8fb2ef24170b9709504794d
- sha1
- 8c0a01c97567e8f814a57e0e729472398fc7e5dc
- sha256
- 156830d6562ff4738bdbe695a16942b8ab2792d29517036e662a7ff11cd2f5d1
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
<?php
/**
* @package Joomla.Administrator
* @subpackage com_scheduler
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Scheduler\Administrator\Task;
/**
* The TaskOptions class.
* Used as the subject argument for the `onTaskOptionsList` event, plugins that support tasks must add them to the
* object through the addOptions() method.
*
* @since 4.1.0
*/
class TaskOptions
{
/**
* An array of TaskOptions
*
* @var TaskOption[]
* @since 4.1.0
*/
public $options = [];
/**
* A plugin can support several task routines
* This method is used by a plugin's onTaskOptionsList subscriber to advertise supported routines.
*
* @param array $taskRoutines An associative array of {@var TaskOption} constructor argument pairs:
* [ 'routineId' => 'languageConstantPrefix', ... ]
*
* @return void
*
* @since 4.1.0
*/
public function addOptions(array $taskRoutines): void
{
foreach ($taskRoutines as $routineId => $langConstPrefix) {
$this->options[] = new TaskOption($routineId, $langConstPrefix);
}
}
/**
* @param ?string $routineId A unique identifier for a plugin task routine
*
* @return ?TaskOption A matching TaskOption if available, null otherwise
*
* @since 4.1.0
*/
public function findOption(?string $routineId): ?TaskOption
{
if ($routineId === null) {
return null;
}
foreach ($this->options as $option) {
if ($option->id === $routineId) {
return $option;
}
}
return null;
}
}
The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.