Active
Project:
Add To Calendar Button (AddEvent.com)
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Jan 2020 at 07:02 UTC
Updated:
11 Aug 2023 at 21:15 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
shree.yesare commentedComment #3
pradeepjha commentedComment #4
pradeepjha commentedHi,
I'm not able to reproduce error. Even page build with layout builder, add to calendar button is showing. Please check this module with Drupal version.
Or let me know steps to reproduce error, then I can help you out.
Steps which I've followed:
Please find attached screenshot.
Comment #5
sharma.amitt16 commentedComment #6
pradeepjha commentedComment #7
matija5 commentedHi, I think I did reproduce this. 1st scenario is what pradeepjha said and it works. If you add AddToCalendar as a field then button is displayed.
But if you take Date field and check AddToCalendar when adding block of this field in Layout Builder then button is not displayed. Please see screenshot.
Regards.
Comment #8
matija5 commentedComment #9
gg24 commentedI'm not able to reproduce the issue. I tried both scenarios suggested by @pradeepjha and @vebrovski but I am able to see properly the Add to Calendar Widget using Layout builder. Please feel free to reopen if in case you still face the issue.
Comment #10
pameeela commentedI'm currently struggling with this issue. Using layout builder, checking the box to enable this on a date field does not seem to do anything. If I revert back to not using LB it works as expected.
And I do not appear to have the option to add 'Add to calendar' as a separate block, as some here have suggested. Don't know what I am missing.
Using Drupal 9.0.7 with 8.x-3.2
Comment #11
pameeela commentedI figured out how to get the block, by adding an 'Add to calendar' field to the node type, but it still doesn't display anything using LB.
Comment #12
danflanagan8Comment #7 appears to be exactly correct.
The "Add to calendar" field type works in Layout Builder.
However, using the "Add to calendar" checkbox when configuring the display of a Date or Daterange field does not work in Layout Builder.
The bug is that in
_addtocalendar_preprocess_field(), the code tries to get settings from the EntityViewDisplay, ignoring whether Layout Builder is in use:So that actually points to a workaround. The
$view_modein the code above evaluates to_customwhen the field is rendering in Layout Builder. That's not a view mode you can configure through field UI. That means the code will end up getting the field formatter configuration for thedefaultview mode.If you configure the default view mode for a Date field with the "Add to calendar" checkbox (though Field UI), then the "Add to calendar" button will show up when that Date field is displayed in Layout Builder.
Comment #13
danflanagan8I found a very similar issue for another module that uses third_party_settings to enhance field formatters. #3099580: Doesn't work in layout builder
The fix there would almost work for us. Unfortunately, we get a first-party setting from the field formatter as well:
$timeZone = (!empty($field_display['settings']['timezone_override'])) ? $field_display['settings']['timezone_override'] : date_default_timezone_get();I don't see how to get that from
$variablesdirectly.