Custom field widget: hook_field_is_empty() I'm creating a custom module that has implemented these hooks:

&lt;?php
/**
 * Implements hook_field_widget_info().
 */
function MYMODULE_field_hook_info() {
  return array(
    'CUSTOM_field' =&gt; array(
      'label' =&gt; t('Custom Text Area'),
      'field_types' =&gt; array('text_long'),
      'behaviors' =&gt; array(
        'multiple values' =&gt; FIELD_BEHAVIOR_DEFAULT,
        'default value' =&gt; FIELD_BEHAVIOR_DEFAULT,
      ),
    ),
  );
}

/**
 * Implements hook_field_widget_form().
 */
function MYMODULE_field_widget_form(&amp;$form, &amp;$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  switch($instance['widget']['type']) {
    case 'CUSTOM_field':
      $element['MYFIELD_field'] = array(
        '#type' =&gt; 'textarea',
        '#attributes' =&gt; array('id' =&gt; 'MYFIELD', 'rows' =&gt; '5', 'cols' =&gt; '3'),
        '#default_value' =&gt; isset($items[$delta]) ? $items[$delta] : '',
      );
      break;
  }
  return array('value' =&gt; $element);
}


All it is supposed to do is provide a custom widget to the Long Text field type that enables some custom functionality. My custom widget appears in manage fields and I can enable it and use it on a node edit form. However, when I save the node with text in the field, nothing saves to the database the data saves to the database, but doesn't display in the field when the node is edited again. 

After some searching, I found some posts that said hook_field_is_empty() is mandatory and is a common problem for values not saving. I attempted to implement the hook exactly as the API said:

&lt;?php
/**
 * Implements hook_field_is_empty().
 */
function MYMODULE_field_is_empty($item, $field) {
  if (empty($item['value']) &amp;&amp; (string) $item['value'] !== '0') {
    return TRUE;
  }
  return FALSE;
}


This immediately started throwing an error in Drupal:


  Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1573 of /includes/bootstrap.inc).


So I looked around some more on here and Google and changed the hook based on this answer:

&lt;?php
/**
 * Implements hook_field_is_empty().
 */
function MYMODULE_field_is_empty($item, $field) {
  if ($field['type'] == 'text_long') {
    if (empty($item[$field['type']]['CUSTOM_field'])) {
      return TRUE;
    }
  }
  return FALSE;
}


This returns the same error and it also doesn't save the value of the field into the database display the field data from the database. Do I have to create a custom field with a MYMODULE.install and the appropriate hooks, or can I just use an existing field type like I'm doing. Why is the data not saving to pulling from the database?
I think you want to change your default values to variable_get('yourmodule_variable') so that it displays the value that was saved previously.