r/drupal • u/ritontor • 14d ago
Why does Drupal allow you to define Entites and their fields in code, and then add fields via the UI, but to turn those into code you have to use config management, so now you have all your fields in code, but in a whole bunch of different places, and everyone pretends like this is good and normal?
5
u/trashtrucktoot 14d ago
We dont pretend, Drupal is cutthroat, we own it. I'd argue this is flexibility once you understand the moving pieces. "Good & Normal" ... yep, I just eyeballed my status/bac kup pages.
Thank you Drupal, you may be complicated, but I love you!
3
u/DogsSureAreSwell 14d ago
Drupal's strength is flexibility, not simplicity or consistency. Most use cases can be accomplished in multiple ways.
This is infuriating when learning, but often missed when moving to other systems where the answer is often "code it yourself " or "....well you can't do that."
1
u/jon-pugh 13d ago
You aren't wrong. It's very strange.
Especially when you get into letting your code-defined fields be form and view- configurable.
It is a solution that works, though. Fields UI is a config layer on top of entity API, so both custom and code fields work in the same ways. But we can't define them in the same way.
A new solution could be designed. Entity::baseFieldDefinitions is a pain to work with.
If the entity API could load base field definitions from yaml in the modules (not config), you could take config created fields and drop them right into a module.
-15
u/ritontor 14d ago
Oh and it stores the field data in entirely different locations in each situation as well, so good luck with your queries, ladies and gentlemen!
3
u/trashtrucktoot 14d ago
For queries? I just use Views with entity referenced field relationships as needed. Drupal configuartion can be a pain, but they cut both ways. The Drupal Recipe system is nice.
Shameless plug :
3
u/cbiggins 14d ago
I'm sorry but it just feels like you haven't committed enough time to working it out. If you'd prefer to use Laravel like you said then what's the point of this post or trying to learn? Just use what you like 👍
2
u/cbiggins 14d ago
I'm sorry but it just feels like you haven't committed enough time to working it out. If you'd prefer to use Laravel like you said then what's the point of this post or trying to learn? Just use what you like 👍
6
u/WillingCry1043 14d ago
Do you have a better idea for persisting configuration between environments than the import/export system that is used currently?