Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions administrator/components/com_scheduler/src/Task/TaskOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down