Add support for field types that extend default entity_reference

Created on 2 September 2022, almost 2 years ago
Updated 8 May 2024, about 2 months ago

Problem/Motivation

Some Drupal contrib modules provide field types that extend the default entity_reference type, ie. dynamic_entity_reference β†’ . This module should allow purging values for these fields as well.

Proposed resolution

Merge an approved patch to support extending field types.

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia taggartj

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany broon Potsdam

    In fact, could this also be used on field types that extend the default entity reference field? In various projects, we are creating custom entity reference fields, that add new functionality, like

    class LabelledEntityReference extends EntityReferenceItem

    offers an Entity Reference Field, but the editor can choose a custom label to refer to the referenced node. As this field type's machine name is of course not "entity_reference", this module does not offer an option.

    So, instead of checking the machine names, isn't possible to get a fields base class and then decide whether or not to offer the purge option?

  • Status changed to Needs work over 1 year ago
  • πŸ‡©πŸ‡ͺGermany broon Potsdam

    Btw. the patch is incomplete as it only patches the field config form. This will add the purge option to dynamic reference fields. However, this option is only read for "entity_reference" fields in the entity_reference_purger_entity_delete function.

  • Status changed to Needs review over 1 year ago
  • πŸ‡©πŸ‡ͺGermany broon Potsdam

    Here is a patch that not only works with dynamic_entity_reference fields but all fields that extend the default entity_reference field. Thus, I am also changing the issue summary (sorry for hijacking, taggartj, but your case is included).

  • πŸ‡³πŸ‡ΏNew Zealand code_brown

    @broon thanks for the patch, this works for our use case. I had to update the patch slightly so that it would apply against the latest version. It just removes the final patch stanza which appears to already be included in the target:

    https://git.drupalcode.org/project/entity_reference_purger/-/blob/1.0.x/...

Production build 0.69.0 2024