You are here

function _wsfields_set_text_format in Web Service Data 7

Find the best text format possible

3 calls to _wsfields_set_text_format()
wsfields_wsfields_text_data_alter in modules/wsfields/wsfields.module
Implements hook_wsfields_FIELD_TYPE_data_alter().
wsfields_wsfields_text_long_data_alter in modules/wsfields/wsfields.module
Implements hook_wsfields_FIELD_TYPE_data_alter().
wsfields_wsfields_text_with_summary_data_alter in modules/wsfields/wsfields.module
Implements hook_wsfields_FIELD_TYPE_data_alter().

File

modules/wsfields/wsfields.module, line 503
Defines core functionality for web service powered fields

Code

function _wsfields_set_text_format(&$data, &$field) {
  $formats = array_keys(filter_formats());
  if (sizeof($formats) > 0) {
    if (in_array('full_html', $formats)) {
      $format = 'full_html';
    }
    else {
      $format = $formats[0];
    }
    foreach ($data as $lang => $values) {
      foreach ($values as $id => $field) {
        $data[$lang][$id]['format'] = $format;
      }
    }
  }
}