You are here

function spaces_handler_field_spaces_feature::render in Spaces 7

Same name and namespace in other branches
  1. 6.3 includes/spaces_handler_field_spaces_feature.inc \spaces_handler_field_spaces_feature::render()
  2. 6 includes/spaces_handler_field_spaces_feature.inc \spaces_handler_field_spaces_feature::render()
  3. 6.2 includes/spaces_handler_field_spaces_feature.inc \spaces_handler_field_spaces_feature::render()
  4. 7.3 includes/spaces_handler_field_spaces_feature.inc \spaces_handler_field_spaces_feature::render()

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field_node_type::render

File

includes/spaces_handler_field_spaces_feature.inc, line 7

Class

spaces_handler_field_spaces_feature
Field handler to translate a node type into its spaces feature.

Code

function render($values) {
  static $map;
  static $features;
  if (!isset($map)) {
    $map = features_get_component_map('node');
    $features = spaces_features();
  }
  $output = '';
  if (!empty($map[$values->{$this->field_alias}])) {
    $feature = reset($map[$values->{$this->field_alias}]);
    $label = $this->options['machine_name'] == TRUE ? $features[$feature]->name : $features[$feature]->info['name'];
    $output = "<span class='spaces-feature feature-{$feature}'>{$label}</span>";
  }
  return $output;
}