themehybrid / hybrid-core

Official repository for the Hybrid Core WordPress development framework.
GNU General Public License v2.0
687 stars 143 forks source link

`hybrid_get_content_template()` - enhance w/ model data parameter? #149

Closed lkraav closed 6 years ago

lkraav commented 6 years ago

As we're approaching 2018 and I'm reading and pondering https://wordpress.stackexchange.com/questions/184235/best-way-of-passing-php-variable-between-partials - wdyt @justintadlock could hybrid_get_content_template() take a MVC step and provide a parameter to pass a data model into the template for saner rendering? cc @Rarst - thai baht for your thoughts?

Maybe even integrate something like http://www.foilphp.it/docs/GETTING-STARTED/ENGINE.html ... because @gmazzap is mostly a trustworthy genius.

EDIT after exploring HC4.0's Hybrid_Registry class, in this API's context, the question could be formulated as "what could the appropriate methods and naming conventions be for defining template data models in this registry".

Rarst commented 6 years ago

hybrid_get_content_template() is a template tag itself. Why would one template pass "model" data to another template? :)

lkraav commented 6 years ago

hybrid_get_content_template() is a template tag itself. Why would one template pass "model" data to another template? :)

I see what you mean.

Just now did my first HC4.0 migration and was looking through https://themehybrid.com/weblog/hybrid-core-version-4-0-0. Looks like @justintadlock is providing a couple of new facilities, "Registry API" seems to be related. Maybe this is the appropriate integration level, but I'm still researching details.

justintadlock commented 6 years ago

Closing this out. The 5.0 branch has the new View class and related functions that allow you to pass any data you want into a template.

This is replacing hybrid_get_content_template() and similar functions.