*/
/**
- * Page for configuring CKEditor options.
- *
- * Note that while this is implemented as a CRM_Core_Page, it is actually a form.
- * Because the form needs to be submitted and refreshed via javascript, it seemed like
- * Quickform and CRM_Core_Form/Controller might get in the way.
+ * Form for configuring CKEditor options.
*/
-class CRM_Admin_Page_CKEditorConfig extends CRM_Core_Page {
+class CRM_Admin_Form_CKEditorConfig extends CRM_Core_Form {
const CONFIG_FILEPATH = '[civicrm.files]/persist/crm-ckeditor-';
*
* @return string
*/
- public function run() {
+ public function preProcess() {
$this->preset = CRM_Utils_Array::value('preset', $_REQUEST, 'default');
-
// If the form was submitted, take appropriate action.
if (!empty($_POST['revert'])) {
self::deleteConfigFile($this->preset);
],
]);
- return parent::run();
+ return parent::preProcess();
}
/**
// add wysiwyg editor
$editor = Civi::settings()->get('editor_id');
if ($editor == "CKEditor") {
- CRM_Admin_Page_CKEditorConfig::setConfigDefault();
+ CRM_Admin_Form_CKEditorConfig::setConfigDefault();
$items[] = [
'config' => [
'wysisygScriptLocation' => Civi::paths()->getUrl("[civicrm.root]/js/wysiwyg/crm.ckeditor.js"),
- 'CKEditorCustomConfig' => CRM_Admin_Page_CKEditorConfig::getConfigUrl(),
+ 'CKEditorCustomConfig' => CRM_Admin_Form_CKEditorConfig::getConfigUrl(),
],
];
}
<item>
<path>civicrm/admin/ckeditor</path>
<title>Configure CKEditor</title>
- <page_callback>CRM_Admin_Page_CKEditorConfig</page_callback>
+ <page_callback>CRM_Admin_Form_CKEditorConfig</page_callback>
<access_arguments>administer CiviCRM</access_arguments>
</item>
</menu>
var selectorOpen = false,
changedWhileOpen = false;
- $('#toolbarModifierForm')
+ $('#CKEditorConfig')
.on('submit', function(e) {
$('.toolbar button:last', '#toolbarModifierWrapper')[0].click();
$('.configContainer textarea', '#toolbarModifierWrapper').attr('name', 'config');
.on('change', '.config-param', function(e) {
changedWhileOpen = true;
if (!selectorOpen) {
- $('#toolbarModifierForm').submit().block();
+ $('#CKEditorConfig').submit().block();
}
})
.on('change', 'input.crm-config-option-name', changeOptionName)