Revert "Re-applying patch from http://drupal.org/files/views_integration-588728-11...
[sandbox/ergonlogic/1226310.git] / modules / hosting / site / views_handler_field_hosting_site_status.inc
1 <?php
2
3
4 class views_handler_field_hosting_site_status extends views_handler_field {
5 function option_definition() {
6 $options = parent::option_definition();
7
8 $options['status_icon'] = array('default' => '0');
9
10 return $options;
11 }
12
13 function options_form(&$form, &$form_state) {
14 parent::options_form($form, $form_state);
15
16 $form['status_icon'] = array(
17 '#type' => 'radios',
18 '#title' => t('Display icon'),
19 '#options' => array('Text', 'Image', 'Both'),
20 '#default_value' => isset($this->options['status_icon']) ? $this->options['status_icon'] : '0',
21 '#description' => t("Display icons instead of status values.")
22 );
23 }
24
25 function render($values) {
26 $value = $values->{$this->field_alias};
27 $output = _hosting_site_status($value);
28
29 if ($this->options['status_icon'] == 1) {
30 $output = "<span class='hosting-status hosting-status-icon'></span>";
31 }
32 elseif ($this->options['status_icon'] == 2) {
33 $output = "<span class='hosting-status'>{$output}</span>";
34 }
35 return $output;
36 }
37 }