You are here

function markup_translate_instance in Markup 7

Tries to translate the value of the field.

Parameters

array $field: The field structure for the markup field.

array $instance: The field instance that is being translated.

Return value

string Either the translated value or the original value. In both cases, the string is "display safe".

2 calls to markup_translate_instance()
markup_field_formatter_prepare_view in ./markup.module
Implements hook_field_formatter_prepare_view().
markup_field_widget_form in ./markup.module
Implements hook_field_widget_form().

File

./markup.module, line 182
Defines a field type for displaying markup on the node/edit form.

Code

function markup_translate_instance($field, $instance) {

  // Translate the markup setting when possible.
  if (function_exists('i18n_string_text')) {
    $i18n_string_name = "field:{$instance['field_name']}:#field:markup";
    $options = array(
      'format' => $field['settings']['markup']['format'],
      // Apply text filter for source.
      'sanitize default' => TRUE,
    );
    return i18n_string_text($i18n_string_name, $field['settings']['markup']['value'], $options);
  }
  return check_markup($field['settings']['markup']['value'], $field['settings']['markup']['format']);
}