You are here

function no_nbsp_field_formatter_view in No Non-breaking Space Filter 7

Implements hook_field_formatter_view().

Related topics

File

./no_nbsp.module, line 95
A filter module that deletes all non-breaking spaces.

Code

function no_nbsp_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $settings = $display['settings'];
  $element = array();
  if ($display['type'] == 'no_nbsp') {
    foreach ($items as $delta => $item) {
      $element[$delta] = array(
        '#markup' => _no_nbsp_eraser($item['value'], isset($settings['preserve_placeholders']) ? $settings['preserve_placeholders'] : FALSE),
      );
    }
  }
  return $element;
}