class clients_views_handler_field in Web Service Clients 6
Same name and namespace in other branches
- 7 clients/clients_views/handlers/clients_views_handler_field.inc \clients_views_handler_field
@todo Is this handler doing anything useful or can it be removed??
Hierarchy
- class \clients_views_handler_field extends \views_handler_field
Expanded class hierarchy of clients_views_handler_field
2 string references to 'clients_views_handler_field'
- clients_views_views_data in clients/
clients_views/ clients_views.module - clients_views_views_handlers in clients/
clients_views/ clients_views.module - Implementation of hook_views_handlers() to register all of the basic handlers views uses.
File
- clients/
clients_views/ handlers/ clients_views_handler_field.inc, line 6
View source
class clients_views_handler_field extends views_handler_field {
/**
* Run before any fields are rendered.
*
* This gives the handlers some time to set up before any handler has
* been rendered.
*
* @param $values
* An array of all objects returned from the query.
*/
function pre_render($values) {
}
/**
* Render the field.
*
* @param $values
* The values retrieved from the database.
*/
function render($values) {
// TODO properly set field_alias all the time.
if (isset($values[$this->real_field])) {
$value = $values[$this->real_field];
}
else {
$value = $values[$this->field_alias];
}
return check_plain($value);
}
/**
* Add 'additional' fields to the query.
*
* @param $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
* @code array('table' => $tablename, 'field' => $fieldname) @endcode
*/
function add_additional_fields($fields = NULL) {
if (!isset($fields)) {
// notice check
if (empty($this->additional_fields)) {
return;
}
$fields = $this->additional_fields;
}
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;
}
$this->aliases[$identifier] = $this->query
->add_field($table_alias, $info['field']);
}
else {
$this->aliases[$info] = $this->query
->add_field($this->table_alias, $info);
}
}
}
}
function theme($values) {
return theme($this
->theme_functions(), $this->view, $this, $values);
}
/**
* Return DIV or SPAN based upon the field's element type.
*/
function element_type() {
if (isset($this->definition['element type'])) {
return $this->definition['element type'];
}
return 'span';
}
/**
* Get this field's label.
*/
function label() {
if (!isset($this->options['label'])) {
return '';
}
return $this->options['label'];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
clients_views_handler_field:: |
function | Add 'additional' fields to the query. | ||
clients_views_handler_field:: |
function | Return DIV or SPAN based upon the field's element type. | ||
clients_views_handler_field:: |
function | Get this field's label. | ||
clients_views_handler_field:: |
function | Run before any fields are rendered. | ||
clients_views_handler_field:: |
function | Render the field. | ||
clients_views_handler_field:: |
function |