From c492d41f3be26601eeabfcf490d334fde81c7b4c Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Tue, 27 Aug 2013 21:36:21 +0800 Subject: [PATCH] MDL-41098 atto: Enable atto text editor on upgrade TinyMCE is still the default. --- lib/editor/atto/db/install.php | 49 ++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lib/editor/atto/db/install.php diff --git a/lib/editor/atto/db/install.php b/lib/editor/atto/db/install.php new file mode 100644 index 00000000000..6fd16b58178 --- /dev/null +++ b/lib/editor/atto/db/install.php @@ -0,0 +1,49 @@ +. + +/** + * Atto text editor installation steps. + * + * @package editor_atto + * @copyright 2013 Damyon Wiese + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +/** + * Enable this text editor by default. + * + * @return bool + */ +function xmldb_editor_atto_install() { + global $CFG; + // Get the current list of editors. + $currentconfig = $CFG->texteditors; + if (is_null($currentconfig)) { + $currentconfig = ''; + } + $editors = explode(',', $currentconfig); + // Insert atto in the second position. + array_splice($editors, 1, 0, array('atto')); + // Remove duplicates. + $editors = array_unique($editors); + // Set the new config. + unset_config('texteditors'); + set_config('texteditors', implode(',', $editors)); + + return true; +} -- 2.43.0