coastercms
coastercms copied to clipboard
Unexpected template behavior
Intended result: IF email field exists show contact form ENDIF
In my template I have this:
@if (PageBuilder::block('email'))
{!! PageBuilder::block('contact_form') !!}
@endif
The idea is to check if the email field exists show the form if not skip it.
By doing that the Block change doesn't see what's in the IF check.
Work around: delete the if/endif and run the block update check. Then paste back the the if conditional.
This is probably to do with what the 'email' block is returning. We've recently added an option to the blocks 'review_return_value' which will force the theme review function to see whatever you pass through like this:
@if (PageBuilder::block('email', ['review_return_value' => true]))
{!! PageBuilder::block('contact_form') !!}
@endif
This should solve the problem...