< 052021-08-06⋎07 >

Topic for #farmOS is: farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Forum: farmOS.discourse.groupSet by mstenta on 2021-06-15 at 12:52
18:19shane_aldrich[m]I started playing with the UI for `genus`, `species`, and `microscope_photos` so I can export those and add them to `farm_shane_fungi`. But when I try to edit the field settings for `microscope_photos` I get this error: "An illegal choice has been detected. Please contact the site administrator." when I try to select unlimited for the number of values. Does this have something to do with the private file system?
18:47paul121[m]hmm. I know that some field settings can't be changed once you've create a field via the UI
18:48paul121[m]but I think you should be able to change the cardinality of the field after it has been created (at least expand from limited -> unlimited)
18:48paul121[m](that is one of the exceptions)
18:48paul121[m](for example you can't change the field ID since the db tables/columns are already created)
18:48paul121[m]you might need to delete the field & recreate if it isn't cooperating with you!
18:58shane_aldrich[m]This happened during the initial creation of the field. So I exported it and have it in phpstorm now. What should I change the cardinality to?
19:00shane_aldrich[m]Nevermind. I looked at the `plant_type` image field and saw it set as `-1`
19:03shane_aldrich[m]OK. So I've gone through the UI to create the following terms and fields: `genus`, `species`, `microscope_photos`, `raw_material`, and `supplement`
19:03shane_aldrich[m]I'll delete what I created through the UI and then install my module to test it out (after I take a shower).
19:08paul121[m]nice!
19:56shane_aldrich[m]So I'm getting "unmet dependencies" for `genus` and `species` when I try to install `farm_shane_fungi`. Can someone look at my `0.0.1` repo for advice?
20:40paul121[m]it looks like both `genus` and `species` depend on the `fugi_type` vocabulary (`taxonomy.vocabulary.fungi_type`)
20:40paul121[m]but I don't see a `taxonomy.vocabulary.fungi_type` in your config/install: github.com/s33a/farm_shane_fungi/tree/0.
20:41paul121[m]might have forgotten to export that vocabulary?
20:41mstenta[m]git.drupalcode.org/project/farm_fungi/-/
20:41mstenta[m]that's provided by `farm_fungi` module
20:42paul121[m]ah yes
20:44paul121[m]I saw `shange_fungi_type` disappeared with the new version, but that makes sense!
20:48paul121[m]maybe this line? github.com/s33a/farm_shane_fungi/blob/55
20:48paul121[m]should be `farm_fungi:farm_fungi` I think?
20:48paul121[m](because `farm_fungi` is provided by the `farm_fungi` project, not the `farm` project)
20:49paul121[m]but maybe that's only a soft requirement and isn't really an issue?
21:11shane_aldrich[m]Just tried `farm_fungi:farm_fungi` in my `info.yml` file and it didn't work. I'll try to do the same with the `field` and `field.storage` files to see what happens.
21:16paul121[m]it probably just needs to be `farm_fungi` in those files if it is needed there
21:18mstenta[m]shane_aldrich were all these configs created in the drupal UI and exported to yml?
21:18mstenta[m]Or did you do anything manually in the yml
21:19mstenta[m]> yea always best to do it in the UI and then export... that way Drupal generates the YML so you can be sure it's all correct
21:19mstenta[m]^
21:20mstenta[m](I'm not at my laptop so my ability to review is limited but taking a quick look now)
21:22mstenta[m]Are both the species and genus fields referencing other terms in the fungi type vocabulary?
21:24shane_aldrich[m]I had the issue from the get-go with the code provided by Drupal. So I added the `farm_fungi` dependency. After changing my `info.yml` file to `farm_fungi:farm_fungi` and removing `farm_fungi:` from ` the `genus` and `species` files, it installs without error. Now to see how things look.
21:26mstenta[m]I don't think the "unmet dependencies" is related to the .info.yml dependencies. Just the config dependencies
21:26mstenta[m]And yeah, in those you don't use the farm_fungi: prefix
21:27shane_aldrich[m]Everything has been pushed to my repo. You can see what I have there now. I think what paul121 mentions about `farm_fungi:farm_fungi` did the trick.
21:27mstenta[m]Which genus and species files are you referring to because there are two of each
21:27shane_aldrich[m]All of them
21:27mstenta[m]Oh it's working now?
21:28paul121[m]it's possible .info.yml issue prevented `farm_fungi` from being installed (that was my thought)
21:28paul121[m]well, not prevented, but didn't depend on it, so it was never installed
21:29shane_aldrich[m]it has been installed for the last few days while I played with the UI stuff.
21:31shane_aldrich[m]Aw crap! somehow I did an undo in phpstorm and it added my `shane_fungi_types` vocabulary back in. so it's showing up in farmOS. I'm just going to ignore that for now.
21:32shane_aldrich[m]just looked at Fungi types vocabulary and neither `genus` nor `species` show up in terms. Hmmm
21:33mstenta[m]One thing to note: if your module provides config in config/install it will NOT be uninstalled when you uninstall the module unless you declare it as an "enforced" dependency
21:34mstenta[m]For example: github.com/farmOS/farmOS/blob/b8b3d8c5d0
21:35mstenta[m]So that is best practice... To ensure that you can uninstall a module (and all the config it provides) cleanly
21:35shane_aldrich[m]so I would need to add `farm_shane_fungi` to the enforced module section as well?
21:35mstenta[m]Yes
21:35mstenta[m]You will notice that if you try to uninstall and then reinstall without that it will error
21:36mstenta[m]Because the config doesn't get uninstalled so it will say it already exists when you try to install again
21:36shane_aldrich[m]OK. I guess I need to to a clean install of farmOS. Or... could I change those files and `drush cr` to see if that works?
21:36mstenta[m]Yea clean install might be easiest
21:36mstenta[m]Drush cr won't do it
21:37mstenta[m]You would need to make that change in yml and then revert them all with the config_update_ui module
21:38mstenta[m](but once you add that stuff to yml and do a fresh install then it will be possible to uninstall+reinstall the module without a whole drupal reinstall)
21:38shane_aldrich[m]Cool. I need to do a couple of personal things for the next 30 minutes. When I get back to the computer, I'll edit the config files and get the fresh install going.
21:43mstenta[m]> just looked at Fungi types vocabulary and neither `genus` nor `species` show up in terms. Hmmm
21:43mstenta[m]I think I know why
21:44mstenta[m]Did you configure "Manage form display" and "Manage display" after you added those fields?
21:44mstenta[m]That is a separate config that needs to be exported (unfortunately IMO)
21:49mstenta[m]So the fields are probably there (tables in the database)
21:50mstenta[m]But they are hidden by default
21:50mstenta[m]Until you provide the config to show them
21:52shane_aldrich[m]When I go into "Manage form display" and "Manage display" they are "disabled". How do I fix that for the next install?
21:52mstenta[m]1. Configure how you want them to appear in both of those places
21:52mstenta[m]2. Export the config for both of those to your module
21:53mstenta[m]Off the top of my head they are called "entity form display" and "entity display" or something like that
21:53mstenta[m](in the config export type drop-down)
21:55shane_aldrich[m]I exported the code from what I generated through the UI for all terms, fields, and field storage with only `farm_fungi` installed. Which is why I don't understand terms not showing up in the "Fungi types" vocabulary.
21:56shane_aldrich[m]The fields show up fine
22:00mstenta[m]Oh maybe I'm misunderstand
22:00mstenta[m]* Oh maybe I'm misunderstanding
22:01shane_aldrich[m]Fresh install happening now
22:02mstenta[m]What do you mean by "terms not showing up in the vocabulary"?
22:07shane_aldrich[m]I'll take a screenshot once I'm back up and running. Installing other modules now.
22:18shane_aldrich[m]There will be a series of screenshots starting with just `farm_fungi` enabled
22:19*uploaded an image: (82KiB) < libera.ems.host/_matrix/media/r0/downloa >
22:19*uploaded an image: (62KiB) < libera.ems.host/_matrix/media/r0/downloa >
22:19shane_aldrich[m]Now I'll install `farm_shane_fungi`
22:21*uploaded an image: (76KiB) < libera.ems.host/_matrix/media/r0/downloa >
22:21*uploaded an image: (77KiB) < libera.ems.host/_matrix/media/r0/downloa >
22:22*uploaded an image: (154KiB) < libera.ems.host/_matrix/media/r0/downloa >
22:22*uploaded an image: (102KiB) < libera.ems.host/_matrix/media/r0/downloa >
22:22shane_aldrich[m]That's it.
22:23mstenta[m]Cool! Looks like the fields installed properly as expected
22:23mstenta[m]Aside from being disabled
22:23mstenta[m]Which will be fixed once you export the form and display config
22:26shane_aldrich[m]But the terms still aren't showing up. Is that due to them being disabled? Also, I can't uninstall my module again. I did the enforced changes, but I probably didn't do it right.
22:29shane_aldrich[m]And I can't figure out how to export those files. I went to `admin/config/development/configuration/single/export` and don't see an option there for those particular files.
22:31paul121[m]"No terms available. Add term." shane_aldrich is that what you think the problem is? (just clarifying)
22:32shane_aldrich[m]Yeah. I have all of the yml config files in `config/install` but they just won't show up there.
22:33paul121[m]ah okay - I think it's just a misunderstanding!
22:33paul121[m]that isn't a problem!
22:34paul121[m]terms themselves are "content entities" - not config entities
22:34paul121[m]if you go to `admin/structure/taxonomy/manage/farm_fungi/add` you can add individual terms
22:34paul121[m]and the "No terms available" message will go away
22:35paul121[m]what you've done is configured the `genus` and `species` fields to be available on each term
22:36shane_aldrich[m]All of that code I used to generate the files came from me adding those terms to "Fungi types" and doing a single export.
22:38shane_aldrich[m]Maybe I'm not understanding "terms" properly here. Are you saying that in that space, it would actually be data that has been entered for `genus` and `species`?
22:38paul121[m]shane_aldrich[m]: "adding those *fields* to the fungi_type *vocabulary* and doing a single export" is more correct
22:39paul121[m]yea.. "terms" has a specify meaning in this context
22:39paul121[m] * yea.. "terms" has a specific meaning in this context
22:40shane_aldrich[m]I see what you mean by the code I generated.
22:41paul121[m]<paul121[m]> "if you go to `admin/structure/ta" <- should be `admin/structure/taxonomy/manage/fungi_type/add` - my bad
22:41paul121[m]does that work? that page is where you create an individual "term" (a content entity, a row in the database)
22:42paul121[m]and on those terms you've made it possible to define a `genus` and `species` for that single term
22:42paul121[m] * and for the fungi_type you've made it possible to define a `genus` and `species` for individual terms
22:43shane_aldrich[m]So say I have a `fungi_type` (aka common name) of Reishi, and the `genus` is Gandoderma and the `species` is lucidum, those won't show up until entered into the database.
22:44shane_aldrich[m]Cool. That makes more sense! Now how can I export the "Manage form display" and "Manage display" for Fungi types?
22:46paul121[m]should be possible from the same page, export single item, "entity form display" and "entity view display" are the "configuration types"
22:46paul121[m]the "configuration name" should be `taxonomy_term.fungi_type.default`
22:47shane_aldrich[m]This is the only name I see "taxonomy_term.plant_type.default"
22:47paul121[m]mm okay. so you probably need to modify it first
22:48paul121[m]from your screenshots it didn't look like it was modified yet
22:48shane_aldrich[m]So just make a quick change and save?
22:48paul121[m](drag the genus and species up out of the disabled part of the table)
22:48paul121[m]yep
22:50mstenta[m](I'm having dinner with family but 👍👍 to what paul121 said 😊)
22:50shane_aldrich[m]don't talk to us while your having dinner with the fam! 🤣
22:51paul121[m]haha
22:52shane_aldrich[m]That worked like a charm! Now I can move on with that aspect and apply it to `substrate_type`
22:52shane_aldrich[m]But... I would like to know why I still can't uninstall my module. Help! 😜
22:53paul121[m]can't uninstall `farm_shane_fungi` ?
22:53shane_aldrich[m]yup
22:53paul121[m]did it give a reason?
22:53shane_aldrich[m]the checkbox is greyed out
22:54mstenta[m]github.com/s33a/farm_shane_fungi/blob/07
22:54mstenta[m]Don't need that
22:54mstenta[m]Not sure if that's why
22:55paul121[m]it should say something like:
22:55paul121[m]> The following reason prevents Log from being uninstalled:
22:55paul121[m]- ...
22:58shane_aldrich[m]It was me just being stupid... I was trying to do it through "Extend List"
22:58shane_aldrich[m]Re-installing now
22:59paul121[m]ooh, yea, I often do the same
23:01shane_aldrich[m]Here's a new error: "Unable to install Shane Fungi, core.entity_form_display.taxonomy_term.fungi_type.default, core.entity_view_display.taxonomy_term.fungi_type.default already exist in active configuration."
23:01shane_aldrich[m]is that in the database?
23:01paul121[m]ahh this is what mike mentioned earlier
23:02paul121[m]can you go here? localhost/admin/config/development/confi
23:03paul121[m](need to install the Configuration Update Reports module if not)
23:03shane_aldrich[m]I
23:03shane_aldrich[m] * I'm there
23:04paul121[m]so search for those `fungi_type` configs on that page
23:04paul121[m]and delete them
23:04paul121[m]! only delete the `core.entity_form/view_display.taxonomy_term.fungi_type.default.yml` config
23:05shane_aldrich[m]on it
23:06paul121[m]I would guess they are in the "Added configuration items" group
23:07shane_aldrich[m]Worked! I just did Ctl+F to find "core" and those were the first two
23:07paul121[m]nice, and you were able to install?
23:07shane_aldrich[m]indeed!
23:07paul121[m]great!
23:08shane_aldrich[m]I'm going to sign off for the day. Thank you guys for all of your help!
23:09paul121[m]np!

< 052021-08-06⋏07 >