Seems to be the exact same issue as the issue against version 2 of the module but it's happening again in 3.
I added my custom field:
$fields['date'] = BaseFieldDefinition::create('smartdate')
->setLabel(t('Date'))
->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
->setRequired(TRUE)
->setSetting('allow_recurring', TRUE)
->setDisplayOptions('form', [
'type' => 'smartdate_default',
'weight' => -3,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
I can see the field in the manage form and when creating the Entity but when you go to save it throws the following error.
Error: Call to undefined method Drupal\\Core\\Field\\BaseFieldDefinition::getThirdPartySetting() in /var/www/modules/contrib/smart_date/src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php on line 305 #0 /var/www/core/lib/Drupal/Cor
e/Field/WidgetBase.php(390): Drupal\\smart_date\\Plugin\\Field\\FieldWidget\\SmartDateWidgetBase->massageFormValues(Array, Array, Object(Drupal\\Core\\Form\\FormState))
Looking at the patch vs version 2 it looks different enough that it's not an easy patch convert. Let me know if you have any ideas to help get this patched quickly.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | smart_date-custom_entities-3174274-4.patch | 3.88 KB | mandclu |
Comments
Comment #2
josh.fabeanCreated a really hacky patch to get me by for tonight.
Comment #3
mandclu commentedAt a high level, that's largely the approach I had in mind. For it to work exactly with custom entities the way it does for fieldable bundles, there should be a method to specify this. Maybe something like
->setSetting('month_limit', 24)?Comment #4
mandclu commentedHere's a patch that tries to centralize the logic for getting the month_limit value based on the method available. It should be possible to set a value for this using the setSetting method.
I also started a documentation page on using Smart Date with custom entities at:
https://www.drupal.org/docs/contributed-modules/smart-date/recurring-dat...
If you have any additional insights based on your development of Bookable Calendar, feel free to edit that page.
Comment #5
josh.fabeanI have that installed on my site and it's been one day without any issues.
Comment #7
mandclu commentedSounds like an implied RTBC, so I'm going to go ahead and merge this in.