Problem/Motivation

Some data types do not store entity references in entity reference fields for various reasons. An example is the Viewsreference module, that allows an editor to add various filters on a View based on taxonomy term references. However, these are stored as serialized data in the field value so they are not found by Term Merge.

As a short term solution I subclassed the TermConfirm form and added a submit handler for these data types. In the additional submit handler, it would be nice to have the same methods and properties available. However, these are currently defined as 'private' so they can only be accessed from the class itself.

Proposed resolution

Make helper methods on MergeTermsConfirm protected, so they can be access from a subclass.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

None.

API changes

Helper methods on MergeTermsConfirm are now protected, so they can be access from a subclass.

Data model changes

None.

Comments

idebr created an issue. See original summary.

idebr’s picture

Status: Active » Needs review
StatusFileSize
new1.65 KB

Attached patch makes the following helper methods on MergeTermsConfirm protected, so they can be access from a subclass:

  • getSelectedTermIds()
  • getSelectedTermLabels()
  • loadSelectedTerms()
idebr’s picture

Title: Make helper methods on MergeTermsConfirm protected, so they can be access from a subclass » Make helper methods and properties on MergeTermsConfirm protected, so they can be accessed from a subclass
StatusFileSize
new705 bytes
new2.18 KB

In addition to the methods in #2, these properties should be protected as well, so they can be used from a subclass:

  • tempStoreFactory
  • termMerger
  • vocabulary
wilfred waltman’s picture

Thanks @idebr, usefull patch.

legolasbo’s picture

@idebr,

Could you please provide some more information about the use case which lead to your subclassing the form? Perhaps that's a use case we should just support by default.

idebr’s picture

Issue summary: View changes

#5 I have updated my use case in the issue summary:

Some data types do not store entity references in entity reference fields for various reasons. An example is the Viewsreference module, that allows an editor to add various filters on a View based on taxonomy term references. However, these are stored as serialized data in the field value so they are not found by Term Merge.

As a short term solution I subclassed the TermConfirm form and added a submit handler for these data types.

A more elegant solution would be to make the Term Merger pluggable, so the selected terms and make the target terms available in the plugin instead. I suppose this is out of scope for this issue though.

legolasbo’s picture

Am I correct in thinking that adding something like a TermsBeingMerged and a TermsHaveBeenMerged event would be enough to fit the bill for your use case? You'd be able to subscribe to the event and add/remove certain terms to/from the list of terms to be merged and/or update any references to now merged terms in depending configuration like the views use case you mentioned in the summary?

If that's the case, then this issue relates to #2974904: Event or Hook desireable

legolasbo’s picture

Status: Needs review » Postponed (maintainer needs more info)

The question in the last comment still needs answering.

idebr’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Yes, the suggestion in #7 would work just as well. I'll close this issue as it is no longer necessary for my use case.

My apologies for the late response, I lost track of this issue.