function views_handler_field::add_additional_fields

cis7 views_handler_field.inc views_handler_field::add_additional_fields($fields = NULL)
cle7 views_handler_field.inc views_handler_field::add_additional_fields($fields = NULL)
elmsmedia7 views_handler_field.inc views_handler_field::add_additional_fields($fields = NULL)
icor7 views_handler_field.inc views_handler_field::add_additional_fields($fields = NULL)
meedjum_blog7 views_handler_field.inc views_handler_field::add_additional_fields($fields = NULL)
mooc7 views_handler_field.inc views_handler_field::add_additional_fields($fields = NULL)

Add 'additional' fields to the query.

array('table' => $tablename, 'field' => $fieldname) 

Parameters

$fields: An array of fields. The key is an identifier used to later find the field alias used. The value is either a string in which case it's assumed to be a field on this handler's table; or it's an array in the form of

21 calls to views_handler_field::add_additional_fields()
accessibility_handler_link_field::query in sites/all/modules/ulmus/accessibility/views/accessibility_handler_link_field.inc
accessibility_handler_status::query in sites/all/modules/ulmus/accessibility/views/accessibility_handler_status.inc
data_node_views_handler_field_add_remove::query in sites/all/modules/local_contrib/data/data_node/views/data_node_views_handler_field_add_remove.inc
Called to add the field to a query.
data_taxonomy_views_handler_field_form::query in sites/all/modules/local_contrib/data/data_taxonomy/views/data_taxonomy_views_handler_field_form.inc
Add field on which we join.
og_handler_field_og_membership_link_delete::query in sites/all/modules/ulmus/og/includes/views/handlers/og_handler_field_og_membership_link_delete.inc
Overriden to add the field for the entity id.

... See full list

File

sites/all/modules/ulmus/views/handlers/views_handler_field.inc, line 115
@todo.

Class

views_handler_field
Base field handler that has no options and renders an unformatted field.

Code

function add_additional_fields($fields = NULL) {
  if (!isset($fields)) {
    // notice check
    if (empty($this->additional_fields)) {
      return;
    }
    $fields = $this->additional_fields;
  }

  $group_params = array();
  if ($this->options['group_type'] != 'group') {
    $group_params = array(
      'function' => $this->options['group_type'],
    );
  }

  if (!empty($fields) && is_array($fields)) {
    foreach ($fields as $identifier => $info) {
      if (is_array($info)) {
        if (isset($info['table'])) {
          $table_alias = $this->query->ensure_table($info['table'], $this->relationship);
        }
        else {
          $table_alias = $this->table_alias;
        }

        if (empty($table_alias)) {
          debug(t('Handler @handler tried to add additional_field @identifier but @table could not be added!', array('@handler' => $this->definition['handler'], '@identifier' => $identifier, '@table' => $info['table'])));
          $this->aliases[$identifier] = 'broken';
          continue;
        }

        $params = array();
        if (!empty($info['params'])) {
          $params = $info['params'];
        }

        $params += $group_params;
        $this->aliases[$identifier] = $this->query->add_field($table_alias, $info['field'], NULL, $params);
      }
      else {
        $this->aliases[$info] = $this->query->add_field($this->table_alias, $info, NULL, $group_params);
      }
    }
  }
}