mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-21 03:09:38 +03:00
Pattern consistent way to add new required fields to submissions [i.e. NSFW checkbox] so DB remains agnostic to my changes? #2711
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mxchinegod on GitHub (Mar 19, 2022).
Attempted Debugging
Searched GitHub Issues
Describe the Scenario
I could hunt down every pattern in DB and front-end and in fact have for some things, but I don't want to do this incorrectly and create bad references in the database model for pages, etc.
How can I easily and best add new metadata fields to content which can be used to filter, search, like the existing ones, but make sure it is static and required unlike the 'add new fields' functionality (which is great, but optional).
Exact BookStack Version
v21.11-dev
Log Content
No response
PHP Version
No response
Hosting Environment
Ubuntu 20.04
@ssddanbrown commented on GitHub (Mar 19, 2022):
Hi @DylanAlloy,
There is no such system to add additional fields or metadata.
The closest similar option we have is the tag system but there are currently freely editable, not built in a way which can be required.
@mxchinegod commented on GitHub (Mar 19, 2022):
From a project perspective, is there a list of files you recommend I work in to get started with this feature? I know it's vast but your tenure in the folder/project structure may save me a lot of time digging.
Thank you.
@ssddanbrown commented on GitHub (Mar 19, 2022):
Are you familiar with Laravel? Much of the codebase follows general Laravel conventions since that's the codebase used.
You'd probably need to create a new model to hold details of your optional fields.
Then edit the relevant form views and controller methods to implement and handle the data from those views.
Then you'll need to update any views where you want that data to appear.
Then you'll need to update any related areas where you need functionality, such as search filters.
If you're just wanting to add this one field, instead of a whole dynamic metadata system, you might be able to save some work by hacking a system together that uses the tag table/models.
Just to confirm, this is not something I'd look to accept into the core project, not at least without understand the core need for such a feature and proof of the wide benefits to existing users, to be worth the maintenance effort. My worry would be that it would be difficult to nail down the scope and use of a feature like this, and it's abstract nature makes things challenging in terms of design, ux and future changes.
@mxchinegod commented on GitHub (Mar 19, 2022):
This is helpful thank you!
Yes this is for a use case
brought to me by an individual. Our scope is well defined and I will be making the changes but have no intention of making a PR. I agree with them that it's a useful feature for content management reasons but I do not wish to be a part of the justifications BookStack requires to make a pull request.
@ssddanbrown commented on GitHub (Mar 20, 2022):
Cool, I'll therefore close this off but if you need any more guidance/pointers then our discord chat can be a good place to get further informal assistance, I usually check in there on a daily basis at least.