TangibleInc / template-system

A template system for WordPress with content type loops and conditions
https://docs.loopsandlogic.com/reference/template-system/
6 stars 2 forks source link

Overview: Content module #105

Open eliot-akira opened 5 months ago

eliot-akira commented 5 months ago

The new Content module in the Framework will provide features to create and manage site content structure.

These will be implemented as general-purpose functions in the Framework, and a separate integration layer for the Template System, such as tags to define field groups.

GabrielGallagher commented 4 months ago

@eliot-akira I noticed there was a commit related to this, and I tried to install it but didn't see any of the new admin menus/settings that the code seemed to indicate would be added. Any way to test drive this?

eliot-akira commented 4 months ago

I added an admin menu Tangible -> Content, but commented it out for now (here). When it's ready for a test drive, I'll add a setting to enable the feature in development, and comment here to let you know.

The core part of the Content module already works (template tags to define custom post types, taxonomies, ACF fields) - but I started a code re-organization that's still in process. I'm separating the template-specific layer, and moving general-purpose functions into the framework, so our templates and plugins have a common way to programmatically define content structure.

I'm also considering something like ACF's Local JSON feature suggested by someone in the forums (Phil, I think).

I like the idea of "content structure templates" that can be import/exported (even copy/pasted). With the power of template tags, one could even use loops to dynamically add post types or field groups.

It will need good documenation, as with the rest of the template system, including reference pages generated from the code.


Another menu added recently, Tangible -> Views, is the basis of a React-based editor interface to unify all template types.

tangible-views-preview

It aims to go beyond the limitations of the archive/edit screens provided by WordPress for custom post types, and support managing a larger amount of templates such as local and cloud libraries.

Its menu is also commented out, since it doesn't do anything yet. There will be a corresponding API on the server side.

Code re-organization is happening here too: separating the WordPress-specific layer, and moving the TypeScript codebase (HTML/CSS engines, code editor integration) into its own module called Elandel.

This is more speculative/ambitious, but the idea is to implement the template language in TypeScript so it can run entirely in the browser, or JavaScript runtime like Node and Bun. It's related to developing smart/intellisense editor features, and will also help improve the PHP implementation by creating a shared template language definition, with more tests and documentation (maybe using TypeDoc).