You are here

function _nodereference_item in Content Construction Kit (CCK) 6

Same name and namespace in other branches
  1. 5 nodereference.module \_nodereference_item()
2 calls to _nodereference_item()
nodereference_allowed_values in modules/nodereference/nodereference.module
Implementation of hook_allowed_values().
nodereference_autocomplete in modules/nodereference/nodereference.module
Retrieve a pipe delimited string of autocomplete suggestions

File

modules/nodereference/nodereference.module, line 648
Defines a field type for referencing one node from another.

Code

function _nodereference_item($field, $item, $html = FALSE) {
  if (module_exists('views') && isset($field['advanced_view']) && $field['advanced_view'] != '--' && ($view = views_get_view($field['advanced_view']))) {
    $field_names = array();
    $view
      ->render();
    foreach ($view->field as $name => $viewfield) {
      $field_names[] = isset($viewfield->definition['content_field_name']) ? $viewfield->definition['content_field_name'] : $name;
    }
    $output = theme('nodereference_item_advanced', $item, $field_names, $view);
    if (!$html) {

      // Views theming runs check_plain (htmlentities) on the values.
      // We reverse that with html_entity_decode.
      $output = html_entity_decode(strip_tags($output), ENT_QUOTES);
    }
  }
  else {
    $output = theme('nodereference_item_simple', $item);
    $output = $html ? check_plain($output) : $output;
  }
  return $output;
}