Is there a way to add an editor like Redactor to a custom TextareaField?
Happy New Year!
You mean on a custom commerce-product?
This takes 2 steps (and is site-specific at the moment):
- Add a unique-ish input_class to the TextareaField. For example, this is the product description field defining a
product-description
class:
$fields[] = new TextareaField($this->commerce, [
'name' => 'description',
'label' => $this->adapter->lexicon('commerce.description'),
'input_class' => 'product-description',
'translations' => $this->getTranslations('description'),
'validation' => [
new Length(0, 1024),
]
]);
- Add that class name to the
commerce.enable_rte_textarea
system setting - multiple values can be separated with a comma. For example,product-description, my-custom-class
.
Do note that this requires Commerce 1.3+, this is not yet supported in 1.2 or before.
1 Like
Thank you! So to be clear, I’ll have to wait for the 1.3 release or did I miss that?
Hi @Vibe_Design
Commerce 1.3 is currently only available in the pre-releases channel, which isn’t recommended for production use. So, don’t worry, you haven’t missed anything!
We’re working hard on it, and hopefully won’t be too much longer before the first release candidate is announced.
1 Like