TinyMCE not showing in CMS

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version: 4.7

Question:

I’m experiencing an issue with the HTMLEditorField. The TinyMCE WYSIWYG editor is not displaying in the CMS.
Not seeing any js errors.
I am running Elemental and the Editor is showing up within the Content block, but nowhere else.
If I change it to a TextareaField it works.


	public function getCMSFields()
	{
		$fields = parent::getCMSFields();

		$fields->removeByName('Sort');

		$fields->addFieldToTab('Root.Main', HTMLEditorField::create('Description'));

		return $fields;
	}

Managed to solve this one in case anyone has trouble with it.

It seems obvious now, but Silverstripe uses all of the formfield templates for the CMS as well as the front end, so if the original template is messed with, it can have unexpected consequences.

The key is don’t replace the Form field templates by putting them in Templates/SilverStripe/Forms, use the setTemplate method instead.