brilliancenw / craft-algolia-sync

Easily Sync Data from Craft CMS Into Algolia
Other
1 stars 3 forks source link

Does not check Element classes which can break integration with other custom Elements #29

Closed BenParizek closed 1 year ago

BenParizek commented 1 year ago

This plugin appears to break Form Submission for Sprout Forms on Craft 3.x.

The issue stems from the plugin using class short names to check for Elements vs. their full namespaced class names. In AlgoliaSyncService::getEventElementInfo() the type is determined with the following code:

$elementTypeSlugArray = explode("\\", get_class($element));
$info['type'] = strtolower(array_pop($elementTypeSlugArray));

However, craft\elements\Entry and something like barrelstrength\sproutforms\elements\Entry now both get the type entry and the code doesn't know how to process the Sprout code as it doesn't include a sectionHandle or sectionId.

This could be resolved by using the full class names for the matches instead of the short names.

markmiddleton commented 1 year ago

Fixed with PR - thank you Ben!