2

I am referring in particular to the textarea that allows one to write a custom confirmation email in the 'Online Registration' tab of an event's configuration page.

Following the CKEditor integration documentation here (http://docs.ckeditor.com/#!/guide/dev_installation-section-adding-ckeditor-to-your-page), I have added some JavaScript to the bottom of templates/CRM/Event/Form/ManageEvent/Registration.tpl to allow the CKEditor user interface to take over the textarea (where confirm_email_text is the name and id of the textarea in question):

CKEDITOR.replace( 'confirm_email_text' );

This appears to work, as the CKEditor interface appears where the textarea did previously. However, any content entered into this CKEditor textbox does not seem to be saved to the database.

The documentation for CK Editor 4 (the version in use on our version of CiviCRM) also says the following:

When CKEditor functions as a replacement for a element, the integration with the parent element is automatic

(see http://docs.ckeditor.com/#!/guide/dev_savedata)

Am I missing something here?

1

So we looked at how one of the existing CKEditor-enabled fields on the page was processed in the civi code base (we chose the footer_text slightly further up the Online Registration page) and tried to replicate the same processing with the confirm_email_text field.

Based on this, we changed two files.

1. civicrm/CRM/Core/I18n/SchemaStructure.php

In the original Civi code on our version this had the following settings for confirm_email_text:

      'confirm_email_text' => array(
        'type' => "TextArea",
        'rows' => "4",
        'cols' => "50",
      ) ,

We changed this (it was around line 644) to:

      'confirm_email_text' => array(
        'type' => "RichTextEditor",
        'rows' => "4",
        'cols' => "50",
      ) ,

In other words, we changed the type from 'TextArea' to 'RichTextEditor'.

2. civicrm/CRM/Event/Form/ManageEvent/Registration.php

In the original Civi code on our version this had the following settings for confirm_email_text:

$form->add('textarea', 'confirm_email_text', ts('Text'), $attributes['confirm_email_text']);

We changed this (it was around line 423) to:

$form->add('wysiwyg', 'confirm_email_text', ts('Text'), $attributes['confirm_email_text']);

In other words, we changed the first argument from 'textarea' to 'wysiwyg'.

One more note

This code sufficed to display the CKEditor instead of the default textarea, and to save and retrieve the text that was written into it. However, during testing we found that our emails were not displaying images that had a src with a % sign in it properly. This was remedied by altering our Message Templates. They had the following line in them by default for including the custom confirmation text at the top of the confirmation email:

{$event.confirm_email_text|htmlize}

We simply removed the htmlize filter, so instead we had:

{$event.confirm_email_text}

This seemed to deal with the problem.

I should note that we removed the line of code mentioned in my original question from Registration.tpl before implementing the actual working solution above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.