views_handler_field_variable_value.inc 660 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * A handler to display data from variable_values
  4. *
  5. * @ingroup views_field_handlers
  6. */
  7. class views_handler_field_variable_value extends views_handler_field {
  8. function construct() {
  9. parent::construct();
  10. // Be explicit about the table we are using.
  11. $this->additional_fields['name'] = array('table' => 'variable', 'field' => 'name');
  12. }
  13. /**
  14. * Render value using variable name for formatting.
  15. */
  16. function render($values) {
  17. $name = $this->get_value($values, 'name');
  18. $variable = variable_build($name);
  19. $variable['value'] = unserialize($this->get_value($values));
  20. return variable_format_value($variable);
  21. }
  22. }