The schema for addtocalendar.settings.addtocalendar_show has type string but the default addtocalendar.settings file has exported addtocalendar_show: 0.

Additionally, the add_to_calendar_field field needs schema configuration. This patch addresses both issues.

Comments

kaythay created an issue. See original summary.

kaythay’s picture

Status: Active » Needs review
stefaniev’s picture

This patch works to make the display text translatable, but unfortunately the list of calendars to show in the button doesn't get saved anymore. No calendars are selected.

gg24’s picture

Status: Needs review » Active
ramya balasubramanian’s picture

Assigned: Unassigned » ramya balasubramanian
ramya balasubramanian’s picture

Please have a look at my below patch and screenshots.

Steps to test 'Add to calendar' Button:

     
  1. Before,applying this patch uninstall this module and apply it
  2.    

  3. Then re-install the module again
  4.    

  5. Add to calendar field is added and add this field in any of your cck. In field settings check the 'Google calender' checkbox.
  6.    

  7. Then add a sample content and check the checkbox 'Show add to calendar widget' and save it
  8.    

  9. You can able to see the 'Add to calendar' button in your node

Please let me know if you are facing any issues

ramya balasubramanian’s picture

Assigned: ramya balasubramanian » Unassigned
Revathi Manohar’s picture

Status: Needs review » Reviewed & tested by the community

Hi,

I have tested the patch it is working for me.

nagarajan kumar’s picture

@ramya thanks for the steps. same am following its work for me.

sorlov’s picture

Status: Reviewed & tested by the community » Needs work

Also need to provide schema for provided Third party settings for date formatters

cause currently I got missing schema error

danflanagan8’s picture

I just added some basic functional test coverage in #3379744: Addtocalendar could use some automated tests! that should be helpful in resolving this issue.

I added protected $strictConfigSchema = FALSE; to the test because indeed there are schema problems in the module. If I remove that declaration and run the test it fails with:

Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for addtocalendar.settings with the following errors: addtocalendar.settings:addtocalendar_show variable type is integer but applied schema class is Drupal\Core\TypedData\Plugin\DataType\StringData

There are other schema problems as well, as the IS notes.

Anyway, now that we have automated tests, the goal of this issue is to get those tests to run after removing the $strictConfigSchema declaration.

danflanagan8’s picture

Assigned: Unassigned » danflanagan8

I just applied the patch in #6 and ran the test locally with the strict schema enforced. I got a little farther I think before the test failed for a schema violation:

1) Drupal\Tests\addtocalendar\Functional\AddToCalendarTest::testAddToCalendarFormatter
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for field.field.node.page.field_addtocalendar with the following errors: field.field.node.page.field_addtocalendar:settings.addtocalendar_settings.data_calendars.iCalendar variable type is integer but applied schema class is Drupal\Core\TypedData\Plugin\DataType\StringData, field.field.node.page.field_addtocalendar:settings.addtocalendar_settings.data_calendars.Outlook Online variable type is integer but applied schema class is Drupal\Core\TypedData\Plugin\DataType\StringData, field.field.node.page.field_addtocalendar:settings.addtocalendar_settings.data_calendars.Yahoo! Calendar variable type is integer but applied schema class is Drupal\Core\TypedData\Plugin\DataType\StringData

So that's one thing that needs fixing. That needs to be string though, so we'll need to update the config in the test module. I think technically that indicates we should include an update hook to force that config update on existing sites.

When I update my zeros to '0' in the test config, the tests pass! Yay!

But I also think that field.field_settings.add_to_calendar_field should extend the core boolean schema since our field extends that field.

I'll make both of these updates.

Regarding #10 I think we should handle that in a new issue since the current test coverage does not cover that case.

danflanagan8’s picture

Status: Needs work » Needs review
StatusFileSize
new4.36 KB
new2.29 KB

Here's an updated patch with everything mentioned in #12.

danflanagan8’s picture

Title: Fix configuration » AddToCalendar config does not match schema, plus some schema missing

  • danflanagan8 committed 7f6743b6 on 8.x-3.x authored by kaythay
    Issue #3092765 by danflanagan8, kaythay: AddToCalendar config does not...
danflanagan8’s picture

Status: Needs review » Fixed

Fixed!

Thank you for the nice work, @kaythay! I noticed that the patch in #6 is simply a re-posted version of your original patch in #2.

I created a followup for the third party settings: #3379787: AddToCalendar third party settings missing schema

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.