function _search_autocomplete_render_fields in Search Autocomplete 7.4
Same name and namespace in other branches
- 7.3 search_autocomplete.view_autocomplete.inc \_search_autocomplete_render_fields()
Renders each field in a row object using a field's theme.
Takes each field from a row object and renders the field as determined by the field's theme
Parameters
object $view: View the row belongs to.
object $row: Row object.
Return value
array Object containing all the raw and rendered fields.
1 call to _search_autocomplete_render_fields()
- SearchAutocompleteViewsPluginStyle::render in views/
plugins/ search_autocomplete.views_plugin_style.inc - Render the display in this style.
File
- ./
search_autocomplete.view_autocomplete.inc, line 36 - Search Autocomplete Enables autocomplete functionality on search fields.
Code
function _search_autocomplete_render_fields($view, $row) {
$field_ids = array_keys($view->field);
$rendered_fields = array();
foreach ($field_ids as $id) {
$field = $view->field[$id];
$field_is_multiple = FALSE;
$field_raw = array();
if (isset($field->options['multiple']['group']) && isset($field->field_values)) {
$field_output = _search_autocomplete_render_multiple_field($field, $row);
$n = 0;
if (is_array($field_output)) {
foreach ($field->field_values[$row->{$field->field_alias}] as $item) {
$field_raw[++$n] = $item["value"];
}
$field_is_multiple = TRUE;
}
else {
$field_raw = $view->field[$field->options['id']]
->advanced_render($row);
}
}
else {
$field_output = $view->field[$field->options['id']]
->advanced_render($row);
$field_raw = isset($view->field[$id]->field_alias) && isset($row->{$view->field[$id]->field_alias}) ? $row->{$view->field[$id]->field_alias} : NULL;
}
if (empty($field->options['exclude'])) {
if (empty($field->options['exclude']) && !($field->options['hide_empty'] && empty($field_output))) {
$object = new stdClass();
$object->id = $id;
// Respect the 'empty' value if empty and "No results text" is given.
if (empty($field_output) && $field->options['empty']) {
$object->content = $field->options['empty'];
}
else {
$object->content = $field_output;
}
$object->raw = $field_raw;
$object->class = drupal_clean_css_identifier(strtolower($id));
$object->label = check_plain($view->field[$id]
->label());
if ($object->label) {
if ($view->field[$id]->options['element_label_colon']) {
$object->label .= ': ';
}
else {
$object->label .= ' ';
}
}
$object->is_multiple = $field_is_multiple;
$rendered_fields[$id] = $object;
}
}
}
return $rendered_fields;
}