-
Notifications
You must be signed in to change notification settings - Fork 789
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
Adding values programmatically through Views is bad practice #5533
Comments
I somewhat agree, but that is how every "how add values programmatically" is done. https://github.com/search?q=repo%3Aumbraco%2FUmbracoDocs%20programmatically&type=code |
Hi @Migaroez thank you for bringing this to our attention. In order to understand the issue better, can you elaborate more specifically on what you would like to change in the documentation and where (if you have a specific content part in mind)? 🙏 |
@Migaroez @alina-tincas @skttl I agree that the way this is currently done is not the best example, and we should prevent it from being adopted. I believe it was chosen at some point because it's a simple way to demonstrate how values can be added from code. As @skttl also points out, this has been done in the same way for all property editors, so if any adjustments are made, it should actually be adapted for all property editors to maintain consistency. One option could be to create examples, for instance, from an API Controller (perhaps there are better scenarios as well?). Of course, we can also add a note indicating that this should not be done from a view, but it was done to quickly and easily illustrate how values can be added from code. |
Hi there 👋 It looks like this discussion has gotten a bit stale over the past 6 months. I also agree, that the samples we use in our documentation like this should ideally be telling a story, or at least use some sort of "real life" example. However, how we go about this is not super clear to me at the moment. One of you suggest using the API controllers, which would also be my go-to if I had to rewrite the samples. I will take this up internally here at Umbraco HQ after the summer holidays, in order to decide how we want to showcase creating content programmatically going forward. Until then, I like the idea of adding a little note about how we're currently using the Views as a quick way to illustrate how values in content can be added/updated from code! So let's do that as a start💪 |
What type of issue is it? (Choose one - delete the others)
Bad practice promotion
What article/section is this about?
(multinode-treepicker)
Describe the issue
We shouldn't be promoting back practices like injecting core services into templates as this can lead to people using the services for content fetching
We should also try to tell a story with a code example and make it as close to a good practice example as possible (no hard coded id's)
The text was updated successfully, but these errors were encountered: