Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collect response options earlier for EE 2.5.5 #60

Closed
wants to merge 1 commit into from

Conversation

ahebrank
Copy link

I'm not sure why I had to do this, but with an old EE 2.5.5 site, these response option template parameters were ignored until I did this to grab them earlier -- presumably it's irrelevant for newer installs sharing in case it helps anyone.

@domstubbs
Copy link
Collaborator

domstubbs commented Nov 20, 2017

I’ve just started to work on an export workflow for an old EE2 site and I’ve noticed the same thing. It looks as though there’s an issue with the Json_Template class overriding ee()->TMPL in its constructor and then failing to restore the original object in its destructor. It does try to restore it but for some reason that’s not working reliably.

It looks as though this class is only instantiated in one place, so a simple workaround is to replicate the intended constructor/destructor behaviour in the main plugin. This seems to work reliably.

$ee_tmpl = ee()->TMPL;
$template = new Json_Template();

$field_data = ee()->api_channel_fields->apply('replace_tag', array($field_data, array(), $tagdata));

if ($template->variables)
{
	$field_data = $template->variables;
}

unset($template);
ee()->TMPL = $ee_tmpl;

I noticed a couple of other Github issues where people report params being ignored and my guess is this is at the root of all of them.

@ahebrank
Copy link
Author

ahebrank commented Oct 5, 2018

Closing out -- haven't tested (can't remember which site I had this issue with), but the note above makes sense.

@ahebrank ahebrank closed this Oct 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants