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

Idea: Component with its own PHP #331

Closed
g105b opened this issue Feb 28, 2022 · 2 comments · Fixed by PhpGt/WebEngine#641
Closed

Idea: Component with its own PHP #331

g105b opened this issue Feb 28, 2022 · 2 comments · Fixed by PhpGt/WebEngine#641

Comments

@g105b
Copy link
Member

g105b commented Feb 28, 2022

If we have a custome-element.html, why no custom-element.php with its own go function?

A special case for the ServiceContainer could provide an HTMLElement already referencing the correct element.

This is how remix does it: https://remix.run/ - a custom element like <invoice-item> can have its view in invoice-item.html and logic in invoice-item.php - the go function will need to know what invoice is being referenced.

Two ideas on how to solve this:

  1. Use the dynamic path as before.
  2. Bind an attribute to the custom element, like an ID, from the page's go function.
@g105b
Copy link
Member Author

g105b commented Oct 31, 2022

For this to work with a single go() function, another repository has to be maintained. This will be fine, but I'll defer it for now until there's more time to put onto this.

The other repository has to split out the functionality of php.gt/routing's LogicStream, so a file can be loaded from gt-component-stream:// location. Currently this is hard-coded for use with Page Logic files, but should be expanded on to be generic, and shared with the loading of components.

@g105b
Copy link
Member Author

g105b commented Oct 18, 2023

This will be closed when PhpGt/ServiceContainer#140 is implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done November 2023
Development

Successfully merging a pull request may close this issue.

1 participant