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
Section Block Context in Helper #393
Comments
Here's what I had to do for the lambda to make the proper context available to the helper within the section block, because the template (which we don't really want to change) is expecting to have the context returned by
|
We found a workaround for this by not using helpers, and modifying the engine to pass the context to lambdas. |
Greetings @bobthecow ! We are an open source project (OpenEMR) trying to port a set of templates from Ruby to PHP.
The problem is that somehow in the Ruby code, the object returned by
patient_characteristic_birthdate
is being pushed onto the context of the block, so that the helper functionbirth_date_time
has access to the model's data directly. Thebirth_date_time
helper seems to magically have access to self['birthDatetime'] when it's called from within the partial, which is a property on the Person model. Self is an instance of PersonCharacteristicBirthDate returned by the Lambda.I don't know how to make that work in PHP. I just have access to the top level context. In PHP can instantiate an entirely new mustache engine instance in the Lambda and create an entirely new context, but I was wondering if there's a proper way to implement this.
Here is the Ruby I'm trying to emulate: Full code is in this repo: https://github.com/projecttacoma/cqm-reports/tree/master/lib/qrda-export/catI-r5
Template/Partial:
Helper:
Lambda:
The text was updated successfully, but these errors were encountered: