You are here

function colectomy_post_render in Colectomy 7

Allows the final field output to be altered.

Checks for the existence of one of the custom #label_display options and does a basic string replacement on the rendered output.

1 string reference to 'colectomy_post_render'
colectomy_field_attach_view_alter in ./colectomy.module
Implements hook_field_attach_view_alter().

File

./colectomy.module, line 77
Allows the option to hide the colon on field labels in field forms.

Code

function colectomy_post_render($output, $element) {
  if (isset($element['#label_display'])) {
    if ($element['#label_display'] == 'abovec' || $element['#label_display'] == 'inlinec') {

      // Matches string 'label' (usually part of the field-label class name) and
      // then the next following colon gets removed. This matches the core
      // field.tpl.php version but if this is overridden in the theme it may not
      // match. The assumption is that if the field.tpl.php is overridden then
      // the user probably won't need this module.
      $output = preg_replace('|(label.+?)(\\:)|', '$1', $output, 1);
    }
  }
  return $output;
}