You are here

function content_plugin_style_php_array_ac::render in Content Construction Kit (CCK) 6.2

Same name and namespace in other branches
  1. 6.3 includes/views/handlers/content_plugin_style_php_array_ac.inc \content_plugin_style_php_array_ac::render()

File

includes/views/handlers/content_plugin_style_php_array_ac.inc, line 8
Handler for 'content_php_array_autocomplete' style.

Class

content_plugin_style_php_array_ac
@file Handler for 'content_php_array_autocomplete' style.

Code

function render() {
  $results = array();

  // Group the rows according to the grouping field, if specified.
  $sets = $this
    ->render_grouping($this->view->result, $this->options['grouping']);
  $base_field = $this->view->base_field;
  $title_field = $this->display->display_options['content_title_field'];
  $title_field_alias = $this->view->field[$title_field]->field_alias;

  // TODO : We don't display grouping info for now.
  // Could be useful for select widget, though.
  $this->view->row_index = 0;
  foreach ($sets as $title => $records) {
    foreach ($records as $label => $row) {
      $results[$row->{$base_field}] = array(
        'title' => $row->{$title_field_alias},
        'rendered' => $this->row_plugin
          ->render($row),
      );
      $this->view->row_index++;
    }
  }
  unset($this->view->row_index);
  return $results;
}