You are here

function addthis_field_presave in AddThis 7.4

Implements hook_field_presave().

Adds a dummy value to $items to make rendering possible.

File

includes/addthis.field.inc, line 107
Field related hook implementations for the AddThis-module.

Code

function addthis_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
  $dummy_value = 'Dummy value';
  if (count($items) == 0) {
    $items += array(
      array(
        'value' => $dummy_value,
      ),
    );
  }
  else {
    foreach ($items as $delta => $value) {
      $items[$delta]['value'] = $dummy_value;
    }
  }
}