Skip to content

Conversation

@spivurno
Copy link
Contributor

@spivurno spivurno commented Feb 1, 2023

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/2135407267/43315/

Summary

Customer was attempting to use our "Populate All Results" snippet to populate all the names entered in a Name field across multiple child entries as a comma-delimited list in a Single Line Text field.

Previously, the snippet used the $object_type->get_object_prop_value() method which did not correctly handle joining the values for multi-input field's like Name fields. The GPPA_Object_Type_GF_Entry::maybe_combine_multi_input_entry_template() method bound to the gppa_process_template filter does but we need to call GP_Populate_Anything::process_template() to fetch the value so that it can be automatically applied.

@claygriffiths My specific concern here is just performance. I've already done my best to mitigate as much damage as possible but wanted to get your sign off that this won't be overly burdensome?

… so each object value is passed through all template filters.
Copy link
Contributor

@claygriffiths claygriffiths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment on lines +16 to +18
if ( $_object === $object ) {
continue;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this check for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just performance. I'd actually prefer to remove since performance isn't a concern. With this, it skips the single object that was selected for population since we already have its parsed template. Only lingering concern here was if the $object passed by the filter would always be the first object in the $objects array.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, got it. FWIW there's a boat load of caching around process_template so if something has been processed already you'll get a cached version of it.

@spivurno spivurno merged commit faf96ac into master Feb 3, 2023
@spivurno spivurno deleted the dave/gppa-populate-all-results/use-process-template branch February 3, 2023 21:23
spivurno added a commit that referenced this pull request Oct 7, 2023
… so each object value is passed through all template filters. (#615)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants