Further simplify form generation #264

Open
opened 2019-07-09 12:51:20 +00:00 by matthijskooijman · 1 comment
matthijskooijman commented 2019-07-09 12:51:20 +00:00 (Migrated from github.com)

In the newtext refactor, we changed form generation to use hypha_substitute, passing a list of variables. These variables are typically class constants with field names, or translations with labels and titles. For example in text: PlanBCode/hypha@be51f688ed/system/datatypes/text.php (L90-L104)

In article, this list of variable will be even longer.

We can probably clean this up a lot by making two changes:

  • Put all the FIELD_* static variables in an array or inner class, so we can pass all of them to hypha_substitute in one go (rather than selecting just the ones needed). In the HTML string, you can then use e.g. [[FIELD_NAME_PAGE_NAME]] directly.
  • Modify hypha_substitute to recognize translations directly, using some special syntax. Perhaps something like [[__title]] or something to mimic __(...) syntax. It is probably good to keep the [[]], so that this the single special syntax inside these strings.
In the newtext refactor, we changed form generation to use `hypha_substitute`, passing a list of variables. These variables are typically class constants with field names, or translations with labels and titles. For example in text: https://github.com/PlanBCode/hypha/blob/be51f688ed569a8276050a146b410a23e618200b/system/datatypes/text.php#L90-L104 In article, this list of variable will be even longer. We can probably clean this up a lot by making two changes: - Put all the `FIELD_*` static variables in an array or inner class, so we can pass *all* of them to `hypha_substitute` in one go (rather than selecting just the ones needed). In the HTML string, you can then use e.g. `[[FIELD_NAME_PAGE_NAME]]` directly. - Modify `hypha_substitute` to recognize translations directly, using some special syntax. Perhaps something like `[[__title]]` or something to mimic `__(...)` syntax. It is probably good to keep the `[[]]`, so that this the single special syntax inside these strings.
matthijskooijman commented 2019-07-09 13:03:03 +00:00 (Migrated from github.com)

Maybe also a syntax for creating infoboxes?

Maybe also a syntax for creating infoboxes?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
harmen/hypha#264
No description provided.