How do I support text formats for an entity property? I have a custom entity I've created following this basic SitePoint tutorial. My custom entity has just two properties, a name and description. My entity is not fieldable (maybe it needs to be?.

I want to make the description support text formats so it's not just interpreted as plain text. Ideally the user could choose text formats like they could for something like a text field added thru the field UI, but since my entity is not fieldable and has no UI for adding fields, I'm not sure where to go with this?
You'll need another property on your entity to hold the format.

In your entity form builder, use a text_format element, and use a validate to move the desired values into place:

$form['description_placeholder'] = array(
  '#type' =&gt; 'text_format',
  '#title' =&gt; t('Description'),
  '#format' =&gt; empty($entity-&gt;description_format) ? 'full_html' : $entity-&gt;description_format,
  '#default_value' =&gt; empty($entity-&gt;description) ? '' : $entity-&gt;description,
);

$form['#validate'][] = 'MYMODULE_entity_validate';

...

function MYMODULE_entity_validate($form, &amp;$form_state) {
  $form_state['values']['description'] = $form_state['values']['description_placeholder']['value'];
  $form_state['values']['description_format'] = $form_state['values']['description_placeholder']['format'];
}


When you render, use:

 $formatted = check_markup($entity-&gt;description, $entity-&gt;description_format);