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.

Comments

josh.fabean created an issue. See original summary.

josh.fabean’s picture

StatusFileSize
new959 bytes

Created a really hacky patch to get me by for tonight.

mandclu’s picture

At 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)?

mandclu’s picture

Status: Active » Needs review
StatusFileSize
new3.88 KB

Here'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.

josh.fabean’s picture

I have that installed on my site and it's been one day without any issues.

  • mandclu committed 5ed605b on 3.0.x
    Issue #3174274 by josh.fabean, mandclu: Smartdate does not work on...
mandclu’s picture

Status: Needs review » Fixed

Sounds like an implied RTBC, so I'm going to go ahead and merge this in.

Status: Fixed » Closed (fixed)

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