Using Drupal 7.59 with PHP Version 7.0.30

Views -> Format -> Show: Calendar Entities - Settings should allow one to
"Set a hex color value (like #ffffff) to use in the calendar legend for each content type.
Items with empty values will have no stripe in the calendar and will not be added to the legend."

When selecting Legend Colors -> Stripes as "Based on Taxonomy" the "Term field"
shows the values for each field in the vocabulary. After making the selections for each color
the "Apply" button is selected and an AJAX HTTP error occurred. Therefore the settings won't save.

HTTP Result Code: 500
Debugging information shows:
Path . . . . admin/structure/views/ajax/display/calendar/cal_month/row_options
StatusText: Service unavailable (with message)
ResponseText: Error: Call to a member function get_option() on null in calendar_plugin_row->options_submit() (line 263 of /home/www/html//sites/all/modules/calendar/includes/calendar_plugin_row.inc).

calendar_plugin_row.inc

258 function options_submit(&$form, &$form_state) {
259 parent::options_submit($form, $form_state);
260 if ($this->view->base_table == 'node') {
261 if (isset($this->view->display['default']->display_options['link_display'])) {
262 $default_display = $this->view->display['default']->display_options['link_display'];
263 $path = $this->view->display[$default_display]->handler->get_option('path');
264 // If this display has been set up as a default tab, the current path
265 // is actually the base path, i.e. if the path is 'calendar/month'
266 // and this is a default tab, the path for this display will actually
267 // be 'calendar'.
268 if ($this->view->display[$default_display]->handler->options['menu']['type'] == 'default tab') {
269 $parts = explode('/', $path);
270 array_pop($parts);
271 $path = implode('/', $parts);
272 }
273 calendar_clear_link_path($path);
274 if (!empty($form_state['values']['row_options']['calendar_date_link'])) {
275 $node_type = $form_state['values']['row_options']['calendar_date_link'];
276 calendar_set_link('node', $node_type, $path);
277 }
278 }
279 }
280 }

Comments

stevecory created an issue. See original summary.

klonos’s picture

Version: 7.x-3.20 » 7.x-3.x-dev
Priority: Major » Normal
Issue tags: -

Hello @stevecory,

Took me some time to figure out what was required in order to test this, but I was unable to reproduce this error with the recent versions of the required modules in Drupal 7.92:

  • Views 7.x-3.x-dev
  • Date 7.x-2.13
  • Ctools 7.x-1.20
  • Calendar 7.x-3.6

For anyone else trying to reproduce this, here's what I've done:

  1. Enabled all the above modules and their requirements
  2. Created a new content type called "Event"
  3. Added a date field to the "Event" content type, leaving the defaults for all options
  4. Added a term reference field to the content type, using the default "Tags" vocabulary that comes with Drupal core - I left the defaults for all field options
  5. Created 3 test terms in the "Tags" vocabulary, caller "term 1", "term 2", and "term 3"
  6. Navigated to admin/structure/views and created a calendar view from the provided templates (click the "+ Add view from template" option at the top-left instead of "+ Add new view")
  7. Used the template "A calendar view of the 'field_event_date' field in the 'node' base table." (or whatever the template is called, depending on the name of the date field you create above)
  8. The view that is automatically generated includes the node title and the event date fields by default, but the taxonomy term field is also required, otherwise the options when configuring the calendar entities will not be shown - so add the taxonomy term field (make sure that you select the correct instance of the field - mine was the one that had the "Appears in: node:event" help text), accepting all defaults for it.
  9. Click on "Settings" next to "Show: Calendar Entities" in the "FORMAT" section in the view
  10. In the "LEGEND COLORS" fieldset, select the "Based on Taxonomy" option from the "Stripes" dropdown menu -> a "Term field" select menu should appear right below (if not, then you missed the step above where you need to add the taxonomy term field to the view - do that first)
  11. Select the tag field from the "Term field" select if not already selected (it should be the default, but there may be multiple options if your event type has multiple taxonomy reference fields)
  12. You should now have a list of all the terms you have added previously in the vocabulary, each one of them presented as a separate text field, with "#ffffff" as the default hex color text
  13. Change that color for one or more of these terms/fields, either by manually typing the hex code, r by selecting a color via the color selector that pops up
  14. Click the "Apply (this display)" button at the bottom of the dialog to save the settings
  15. At this point, I got no error, and when I clicked on "Settings" again, the dialog loaded with my custom colors retained.
  16. Click on "Save" at the top-right to save the view
  17. Edit the view again, and click on "Settings" next to "Show: Calendar Entities" in the "FORMAT" section again, to confirm that the settings are saved indeed.
klonos’s picture

Status: Active » Closed (cannot reproduce)

...I see that the other issue you've created in the Calendar module's issue queue (#2984029: AJAX HTTP error from get_option('path') setting Legend Colors Based on Taxonomy) has also been closed as outdated for some time now, so based on my testing and the inability to reproduce this, as well as the fact that nobody else reported having this issue over the last years, I'm gonna go ahead and close this issue here too.

Thank you for taking the time to report the issue in the first place, and if either you or anyone else are still having this problem with the most recent versions of the required modules, please feel free to reopen, providing any additional information that might help reproduce it.

Cheers

klonos’s picture

StatusFileSize
new72.41 KB

...thought I might as well provide a screenshot from my local testing setup for posterity:

screenshot of the Row style options dialog