Combining CKEditor field and other input fields

I am trying to create a block that has typical form input fields and a CKEditor field as well, i.e., I want $content to be just another field in the table that has other fields as well. I tried various attempts, including trying to add input fields to the existing content block, but nothing works :confused:

How can I add a new field to the content block?

If you make a custom block you can use this code to add a WYSIWYG editor to the edit.php

<?php echoCore::make("editor")->outputStandardEditor('content', $content); ?>

I would not recommend adding a new field to the actual content block, but if you really want to do that you’ll need to copy the whole concrete/blocks/content directory into application/blocks and make your changes there. You will need to add more fields to the database so you’ll have to refresh the block type after you update the db.xml and the rest of the files.

1 Like

Why not simply use a form block?

If you add a Textarea to it, you have the choice between Plain text or Rich text (CKeditor)

wow! I can’t believe it’s that easy, esp after the work I lost trying to make it work. Thanks… works perfectly!

Make sure you check the LikeAbstractor stuff from the Content block to make sure you’re saving/displaying the information correctly.

(You mean LinkAbstractor) and by “check” do you mean to make sure I am using Concrete\Core\Editor\LinkAbstractor ??

Yes, make sure you use the translateTo, translateFrom, and translateFromEditMode functions appropriately.

hmm… so, I need to add

public function getContent() {
        return LinkAbstractor::translateFrom($this->content);
 public function getContentEditMode() {
        return LinkAbstractor::translateFromEditMode($this->content);

to my block’s controller? And if so, do I also need to add all the other functions I see in the content block controller, like

public function getImportData($blockNode, $page)...
public function export(\SimpleXMLElement $blockNode)...
public function getUsedFiles()...