home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (content_plugin_style_php_array_ac.inc)

This example Drupal source code file (content_plugin_style_php_array_ac.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, base_field, extends, foreach, function, php, records, results, return, row, sets, title, title_field_alias, views_plugin_style

The content_plugin_style_php_array_ac.inc Drupal example source code

// $Id: content_plugin_style_php_array_ac.inc,v 2009/11/04 15:31:28 markuspetrux Exp $

 * @file
 * Handler for 'content_php_array_autocomplete' style.
class content_plugin_style_php_array_ac extends views_plugin_style {
  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),
    return $results;

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal content_plugin_style_php_array_ac.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.