diff --git a/administrator/components/com_scheduler/src/Helper/SchedulerHelper.php b/administrator/components/com_scheduler/src/Helper/SchedulerHelper.php index c3dcd616515d5..3d809baeac76f 100644 --- a/administrator/components/com_scheduler/src/Helper/SchedulerHelper.php +++ b/administrator/components/com_scheduler/src/Helper/SchedulerHelper.php @@ -63,6 +63,13 @@ public static function getTaskOptions(): TaskOptions PluginHelper::importPlugin('task'); $app->getDispatcher()->dispatch('onTaskOptionsList', $event); + if (isset($options->options) && \is_array($options->options)) { + // Sort the options alphabetically by title + usort($options->options, function ($a, $b) { + return strcmp($a->getTitle(), $b->getTitle()); + }); + } + self::$taskOptionsCache = $options; return $options; diff --git a/administrator/components/com_scheduler/src/Task/TaskOption.php b/administrator/components/com_scheduler/src/Task/TaskOption.php index 4603edac78d29..2185aa4edfdff 100644 --- a/administrator/components/com_scheduler/src/Task/TaskOption.php +++ b/administrator/components/com_scheduler/src/Task/TaskOption.php @@ -78,6 +78,18 @@ public function __construct(string $type, string $langConstPrefix) $this->langConstPrefix = $langConstPrefix; } + /** + * Method to get the type title. + * + * @return string The type title. + * + * @since __DEPLOY_VERSION__ + */ + public function getTitle(): string + { + return $this->title; + } + /** * Magic method to allow read-only access to private properties. *