You are here

function name_render_component in Name Field 7

Renders a name component value.

This function does not by default sanatise the output unless the markup flag is set. If this is set, it runs the component through check_plain() and wraps the component in a span with the component name set as the class.

1 call to name_render_component()
_name_generate_tokens in includes/name.parser.inc

File

./name.module, line 184
Defines an API for displaying and inputing names.

Code

function name_render_component($value, $component_key, $markup, $modifier = NULL) {
  if (empty($value) || !strlen($value)) {
    return NULL;
  }
  switch ($modifier) {
    case 'initial':
      $value = drupal_substr($value, 0, 1);
      break;
  }
  if ($markup) {
    return '<span class="' . check_plain($component_key) . '">' . check_plain($value) . '</span>';
  }
  return $value;
}