Jump to content

Recommended Posts

Posted

Hi there! I'm writing a module for a website, and it needs to store a bit of text. This works fine:

$inputfields = parent::getInputfields();
$message = $this->modules->get('InputfieldTextarea');
$message->attr('name', 'message');
$message->label = 'Message';
$message->required = true;
$message->set("inputfieldClass", "InputfieldCKEditor");
$inputfields->add($message);

...except the part about the inputfieldClass. Is it possible to make these fields have a "CKEditor" instead? My client would need to add a little markup.

Posted

Just use InputfieldCKEditor directly instead of InputfieldTextarea. You're talking about direct application of Inputfields here. The inputfieldClass needs to be set if you are attaching a field (a FieldtypeTextarea, not InputfieldTextarea) to a template for use in pages.

Posted

Wow, thanks for your speedy reply @BitPoet! This worked like a charm. I didn't realize the input class was only required for templates. Will this play nice with multi language websites, by the way? I might was well implement multi language support right away.

Posted

You're welcome. You can set the useLanguages flag on the CKEditor field to get multi language support.

$message->useLanguages = true;

The only thing you need to aware of is that, as far as I know, there is no fallback to the default language's value if the value in the current language is empty.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...