1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 defined('MOODLE_INTERNAL') || die(); 18 19 /** 20 * Plugin for Moodle 'Toolbar Toggle' button. 21 * 22 * @package tinymce_pdw 23 * @copyright 2013 Jason Fowler 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 class tinymce_pdw extends editor_tinymce_plugin { 27 /** 28 * Adds pdw toggle button if there are more than one row of buttons in TinyMCE 29 * 30 * @param array $params TinyMCE init parameters array 31 * @param context $context Context where editor is being shown 32 * @param array $options Options for this editor 33 */ 34 protected function update_init_params(array &$params, context $context, 35 array $options = null) { 36 37 $rowsnumber = $this->count_button_rows($params); 38 if ($rowsnumber > 1) { 39 $this->add_button_before($params, 1, 'pdw_toggle', ''); 40 $params['pdw_toggle_on'] = 1; 41 $params['pdw_toggle_toolbars'] = join(',', range(2, $rowsnumber)); 42 43 // Add JS file, which uses default name. 44 $this->add_js_plugin($params); 45 } 46 } 47 48 /** 49 * Gets the order in which to run this plugin 50 * 51 * We need pdw plugin to be added the last, so nothing is added before the button. 52 */ 53 protected function get_sort_order() { 54 return 100000; 55 } 56 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body