You are here

function _entityform_format_text in Entityform 7.2

Same name and namespace in other branches
  1. 7 entityform.module \_entityform_format_text()

Replace tokens and convert text to markup filter

Parameters

string $text_value:

array $token_types:

Return value

string

2 calls to _entityform_format_text()
EntityformType::get_path_property in ./entityform.module
EntityformType::get_prop in ./entityform.module

File

./entityform.module, line 1779
Module for the Entityform Entity - a starting point to create your own Entity and associated administration interface

Code

function _entityform_format_text($text_value, $token_types = array()) {
  $is_filtered = FALSE;
  if (is_array($text_value)) {

    // We are dealing for a filtered text value
    $text = $text_value['value'];
    $format = $text_value['format'];
    $is_filtered = TRUE;
  }
  else {
    $text = check_plain($text_value);
  }
  if ($text == '<none>') {
    return '';
  }
  if ($token_types !== FALSE) {
    $token_types[] = 'global';
    $text = token_replace($text, $token_types, array(
      'clear' => TRUE,
    ));
  }
  if ($is_filtered) {
    $text = check_markup($text, $format);
  }
  return $text;
}