MDL-76867 core_admin: Add support for editor sorting via ajax

This commit is contained in:
Andrew Nicols
2023-03-14 08:44:15 +08:00
parent f54cc61e4b
commit 6d978dd35a
13 changed files with 719 additions and 25 deletions
+45 -4
View File
@@ -23,10 +23,10 @@
*/
namespace core\plugininfo;
use core_component, core_plugin_manager, moodle_url, coding_exception;
defined('MOODLE_INTERNAL') || die();
use coding_exception;
use core_component;
use core_plugin_manager;
use moodle_url;
/**
* Base class providing access to the information about a plugin
@@ -71,6 +71,12 @@ abstract class base {
/** @var array|null array of {@link \core\update\info} for this plugin */
protected $availableupdates;
/** @var int Move a plugin up in the plugin order */
public const MOVE_UP = -1;
/** @var int Move a plugin down in the plugin order */
public const MOVE_DOWN = 1;
/**
* Whether this plugintype supports its plugins being disabled.
*
@@ -665,4 +671,39 @@ abstract class base {
'return' => $return,
));
}
/**
* Whether this plugintype supports ordering of plugins using native functionality.
*
* Please note that plugintypes which pre-date this native functionality may still support ordering
* but will not use the built-in functionality.
*
* @return bool
*/
public static function plugintype_supports_ordering(): bool {
return false;
}
/**
* Finds all enabled plugins, the result may include missing plugins.
*
* @param bool $enabledonly Show all plugins, or only those which are enabled
* @return array|null of sorted plugins $pluginname => $pluginname, null means unknown
*/
public static function get_sorted_plugins(bool $enabledonly = false): ?array {
return null;
}
/**
* Change the order of the plugin relative to other plugins in the plugintype.
*
* When possible, the change will be stored into the config_log table, to let admins check when/who has modified it.
*
* @param string $pluginname The plugin name to enable/disable.
* @param int $direction The direction to move the plugin. Negative numbers mean up, Positive mean down.
* @return bool Whether $pluginname has been updated or not.
*/
public static function change_plugin_order(string $pluginname, int $direction): bool {
return false;
}
}