I installed Highcharts 7.x-2.x-dev (4 may 2013). I set up a view & changed the format to Highcharts. Drupal gave an AJAX 500 error. The web server log showed:
PHP Fatal error: Call to undefined function field_analytics_get_allowed_values() in /hosting/somesite/com/htdocs/cms_sandbox/sites/all/modules/highcharts/views/highcharts_views.options.inc on line 148
I discovered that the function field_analytics_get_allowed_values is defined in the Field Analytics contrib module. I installed that module & the error disappeared.
The overview page for the Highcharts module states that Highcharts 7.x-2.x has no dependencies, & the Highcharts Views module only depends on Views. This would appear to be incorrect.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | highcharts_views.options.inc_.patch | 1.84 KB | Pierco |
Comments
Comment #1
bennos commentedconfirming
in highcharts_views.options.inc begin on line 134
two option
we add the dependency or the function get refactored.
Comment #2
Pierco commentedSame error. I added a patch that contains the function from field_analytics module.
Comment #3
scottrigbyGreat work guys!
Quick patch review:
I agree highcharts_views.module shouldn't depend on field_analytics.module.
We may or may not need a new method (see below). But if we do, let's be sure to camel case - like
getAllowedValues.I know this is from my original function from field_analytics.module, but since then I've realized we can take advantage of
hook_options_list(), one way or another.In D7 we may even be able to use the sudo-private function
_options_get_options(), though I haven't tried it yet - does someone want to give that a shot?Looking at that function, if it conflicts with our empty_option, we may want our own method after all, borrowing most of
_options_get_options(), but without the empty_option assumption (since we're adding the options into our own field with it's own empty_options).Note that D8 is somewhat of a moving target on this - noting that
_options_get_options()has been removed. There is a D8 patch that will solve this very issue #1758622: Provide the options list of an entity field, but it still in progress. Additionally noting changes tohook_options_list()are in progress: #1950632: Create a FieldDefinitionInterface and use it for formatters and widgets so we should keep an eye out for that as well.Comment #4
Exploratus commentedthanks!