Created
November 5, 2013 20:58
-
-
Save pvhee/7326203 to your computer and use it in GitHub Desktop.
Extend Scald data views supports to display arrays for nested values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/includes/scald_views_handler_field_data.inc b/includes/scald_views_handler_field_data.inc | |
| index 936f700..583ff42 100644 | |
| --- a/includes/scald_views_handler_field_data.inc | |
| +++ b/includes/scald_views_handler_field_data.inc | |
| @@ -44,7 +44,13 @@ class scald_views_handler_field_data extends views_handler_field { | |
| $data = unserialize($values->{$this->field_alias}); | |
| $content = NULL; | |
| if (!empty($data[$this->options['data_key']])) { | |
| - $output = (string) $data[$this->options['data_key']]; | |
| + | |
| + if (is_array($data[$this->options['data_key']])) { | |
| + $output = var_export($data[$this->options['data_key']], TRUE); | |
| + } else { | |
| + $output = (string) $data[$this->options['data_key']]; | |
| + } | |
| + | |
| $content = array( | |
| '#markup' => $this->options['plain'] ? check_plain($output) : $output, | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment