Pattern consistent way to add new required fields to submissions [i.e. NSFW checkbox] so DB remains agnostic to my changes? #2711

Closed
opened 2026-02-05 04:53:17 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @mxchinegod on GitHub (Mar 19, 2022).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

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

Originally created by @mxchinegod on GitHub (Mar 19, 2022). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### 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
OVERLORD added the 🐕 Support label 2026-02-05 04:53:17 +03:00
Author
Owner

@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.

@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.
Author
Owner

@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.

@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.
Author
Owner

@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.

@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.
Author
Owner

@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.

@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.
Author
Owner

@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.

@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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2711