Skip to main content
added 80 characters in body
Source Link
Robin Schambach
  • 19.8k
  • 1
  • 20
  • 45

Rich Text Field without Entry Twig - render a rich text field

Maybe I have not understand how entries workswork but I would like to create a rich text field in my plugin without having an entry.

All I want is creating a rich text field with twig but how can I do this? I already read this https://craftcms.com/docs/rich-text-fields but it was not really helpful. I would just like to have something like this just for a rich text field instead of a normal textfield

{{ forms.textField({
    label: 'Ingredient Name'|t,
    required: true,
    name: 'ingredient[name]',
    value: ingredient ? ingredient.name : null,
    errors: ingredient ? ingredient.errors('name') : null,
 }) }}

Could someone please help me?

if I make {{ entry.richTextFieldHandle }} I get the error Variable "entry" does not exist and I don't know how to define entry since I don't use an entry. Do I have to include my own redactor.js if I just want to have an html editor?

Rich Text Field without Entry

Maybe I have not understand how entries works but I would like to create a rich text field in my plugin without having an entry.

All I want is creating a rich text field with twig but how can I do this? I already read this https://craftcms.com/docs/rich-text-fields but it was not really helpful. I would just like to have something like this just for a rich text field instead of a normal textfield

{{ forms.textField({
    label: 'Ingredient Name'|t,
    required: true,
    name: 'ingredient[name]',
    value: ingredient ? ingredient.name : null,
    errors: ingredient ? ingredient.errors('name') : null,
 }) }}

Could someone please help me?

if I make {{ entry.richTextFieldHandle }} I get the error Variable "entry" does not exist and I don't know how to define entry since I don't use an entry

Twig - render a rich text field

Maybe I have not understand how entries work but I would like to create a rich text field in my plugin without having an entry.

All I want is creating a rich text field with twig but how can I do this? I already read this https://craftcms.com/docs/rich-text-fields but it was not really helpful. I would just like to have something like this just for a rich text field instead of a normal textfield

{{ forms.textField({
    label: 'Ingredient Name'|t,
    required: true,
    name: 'ingredient[name]',
    value: ingredient ? ingredient.name : null,
    errors: ingredient ? ingredient.errors('name') : null,
 }) }}

Could someone please help me?

if I make {{ entry.richTextFieldHandle }} I get the error Variable "entry" does not exist and I don't know how to define entry since I don't use an entry. Do I have to include my own redactor.js if I just want to have an html editor?

Source Link
Robin Schambach
  • 19.8k
  • 1
  • 20
  • 45

Rich Text Field without Entry

Maybe I have not understand how entries works but I would like to create a rich text field in my plugin without having an entry.

All I want is creating a rich text field with twig but how can I do this? I already read this https://craftcms.com/docs/rich-text-fields but it was not really helpful. I would just like to have something like this just for a rich text field instead of a normal textfield

{{ forms.textField({
    label: 'Ingredient Name'|t,
    required: true,
    name: 'ingredient[name]',
    value: ingredient ? ingredient.name : null,
    errors: ingredient ? ingredient.errors('name') : null,
 }) }}

Could someone please help me?

if I make {{ entry.richTextFieldHandle }} I get the error Variable "entry" does not exist and I don't know how to define entry since I don't use an entry