- md5
- ce756dc4ea24b947b39f3620158108a5
- sha1
- 5899a1f6d227e0aa6d0d1939f4ece4747a9fc83e
- sha256
- 54833f3e0ca6bc41c85ea717d8839ee98a23c4a531d8482096972e3c5f1f0b5d
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
<?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;
// Restrict direct access
\defined('_JEXEC') or die;
/**
* 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->type === $routineId)
{
return $option;
}
}
return null;
}
}
The same content is in 8 releases, Joomla 4.1.0-beta1 to 4.1.0. See them all, or every version of this file.