The ability to filter out entity types from being exported would be very beneficial.

Currently, this is not possible without replacing or decorating the tome_sync.exporter service and overriding both the `$excludedTypes` static property, getContentToExport() and exportContent()

The current method is mostly because self::$excludedTypes is used instead of static::$excludedTypes. Just that one keyword change would allow the `$excludedTypes` to be overridden in child classes. This is due to how late static binding works in php.

I'll attach a quick patch to change self to static but I think it should be configuration driven.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

indytechcook created an issue. See original summary.

indytechcook’s picture

indytechcook’s picture

Status: Active » Needs review
indytechcook’s picture

Issue summary: View changes
samuel.mortenson’s picture

@indytechcook While this change looks OK to me, I'll note that the Exporter class is marked as internal and isn't expected to be extended by other modules. Most of the classes in Tome are marked this way to make maintenance easier. That said, committing this fix seems harmless to me.

Out of curiosity, what entity types are you looking to exclude, and for what purpose? Tome Sync is meant to export your entire site in a way that it can be built from scratch (i.e. rebuilt after dropping databases), which is why almost all entity types are included by default.

indytechcook’s picture

Thanks for the reply @samuel.mortenson

> Out of curiosity, what entity types are you looking to exclude, and for what purpose? Tome Sync is meant to export your entire site in a way that it can be built from scratch (i.e. rebuilt after dropping databases), which is why almost all entity types are included by default.

I'm working with @Elijah Lynn on the va.gov project. We are using tome_sync to make certain content available to our static site generator faster than using graphql. tome_sync is the only part of this project we use and we understand our use case is not the primary use case of tome.

We were having issues with breadcrumb creation on the sync export plus we didn't need all entities exported for our use case. I did find a workaround for the breadcrumb issue by overriding the BaseContentEntityNormalizer.

If you want to see the full PR to accomplish our use cases you can look here: https://github.com/department-of-veterans-affairs/va.gov-cms/pull/827/files

I'm happy to talk more about our use case :)

Elijah Lynn’s picture

Status: Needs review » Reviewed & tested by the community

Thanks Neil!

  • indytechcook authored db5d80e on 8.x-1.x
    Issue #3114961 by indytechcook, Elijah Lynn: Allow excluded entity types...
samuel.mortenson’s picture

Status: Reviewed & tested by the community » Fixed

Finally closing this out, thanks all.

Status: Fixed » Closed (fixed)

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