Correct Markup with CCK (Drupal Quick Tip)
The Drupal Content Construction Kit allows you to create custom content types rather then relying on the default ones. It is an amazing feature and can add real flexibility to the system.
One issue that is often over looked is adding correct markup to the html that the system generates. When you add a custom content type with custom fields, you may notice that your content is not surrounded by <p> tags. You may also notice that Drupal does not recognise line breaks.
This is probably because you have selected Plain text under Text Processing. This must be set to Filtered text, which will add <p> tags to paragraphs and line breaks. You can also manually add HTML in the fields by selecting Full HTML as the input format. The input format will appear under each text field once you set the text processing to filtered text.
To check your current content types, go to:
Administer » Content management » Content types
Click on a relevant content type and the go to manage fields. Click on configure and then scroll down until you find text processing.
If you liked this, you'll love my book, Master Drupal Module Development.
"..the must have drupal developers book"
Feeling stuck with Drupal 8 module dev?
Get the free 7 lesson course that will help you get started today without feeling overwhelmed.
- Create Drupal modules with just a few commands using the Drupal Console
- Create custom pages
- Create custom blocks
- Create admin forms
- Demystify routers and controllers
- Bonus material