cnj-digital / seotamic

A Statamic v4 SEO addon
21 stars 12 forks source link

Seotamic not working when Statamic Entry class is extended #56

Closed GioChocolateBro closed 9 months ago

GioChocolateBro commented 10 months ago

We re-bind some of statamics content classes, like referred to in the documentation: https://statamic.dev/extending/repositories#custom-data-classes

Seotamic checks class types with get_class. This outputs a string of the current class. This fails because it's not this exact class, just an instance of it.

 if (get_class($this->field->parent()) === "Statamic\Entries\Entry") {

If we would use instanceof instead, everything would continue to work as expected but you'll be able to still extend Statamics classes.

if ($this->field->parent() instanceof \Statamic\Entries\Entry) {
GioChocolateBro commented 10 months ago

I can make a PR for this? Currently in the process of making a patch for myself.