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

Missing includes/frontend.php #3

Closed
codepuncher opened this issue Mar 9, 2018 · 4 comments
Closed

Missing includes/frontend.php #3

codepuncher opened this issue Mar 9, 2018 · 4 comments

Comments

@codepuncher
Copy link
Member

codepuncher commented Mar 9, 2018

Although we use filters in FLBuilder to redirect frontend.php of Module to frontend.blade.php, we haven't found a solution for static method render_module_html (located in web/app/plugins/bb-plugin/classes/class-fl-builder.php) because it is hardcoded to includes/frontend.php.

We can develop fine and ignore this, however, there are some places that it throws PHP warnings.
e.g. If you edit a page that has Beaver Builder enabled, you can see in Yoast SEO Meta description a warning that includes/frontend.php does not exist.

Do you have any suggestions to workaround this?

@codepuncher codepuncher changed the title Missing 1includes/frontend.php Missing includes/frontend.php Mar 9, 2018
@tangrufus
Copy link
Contributor

Not so ideal solution:

Keep includes/frontend.blade.php as it is
Add includes/frontend.php:

// includes/frontend.php
<?php

ob_start();
// something like this. To be investigated.
echo sage('blade')->render(__DIR__ . '/frontend.blade.php', $data);

return ob_get_clean();

In other words, create includes/frontend.php for every module

@codepuncher
Copy link
Member Author

That looks like a good solution.
Would this be of any use? https://github.com/ItinerisLtd/sage-flbuilder/blob/master/src/FLBuilderBase.php#L205-L211
Method to redirect frontend.php to frontend.blade.php.

Unsure if best to use \App\locate_template from above file or if your example have many differences?

@tangrufus
Copy link
Contributor

Does the issue happen for MainBanner?
MainBanner has both frontend.blade.php and frontend.php. Which one is loaded?

https://github.com/ItinerisLtd/sage-flbuilder/tree/master/src/Modules/MainBanner/includes

@codepuncher
Copy link
Member Author

Correct.
However, the file frontend.php in that Module contains old obsolete code and is not actually required (you can see the code is different in both files).
Sometimes we just add an empty frontend.php file to get rid of the warnings.
Doing that, though, means any plugins that read filter the_content will see empty frontend.php and not see contents of frontend.blade.php.

I hope that makes sense.

codepuncher added a commit that referenced this issue Aug 12, 2024
fix(PostGrid): `Argument #3 must be of type string
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

No branches or pull requests

2 participants