You are here

function _entityform_format_text in Entityform 7

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

Replace tokens and convert text to markup filter

Parameters

string $text_value:

array $token_types:

Return value

string

4 calls to _entityform_format_text()
EntityformType::get_redirect_path in ./entityform.module
entityform_confirm_page in ./entityform.module
Page callback
entityform_draft_page in ./entityform.module
entityform_form_wrapper in ./entityform.admin.inc
Form callback wrapper: create or edit a entityform.

File

./entityform.module, line 1647
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 ($token_types !== FALSE) {
    $token_types[] = 'global';
    $text = token_replace($text, $token_types);
  }
  if ($is_filtered) {
    $text = check_markup($text, $format);
  }
  return $text;
}