< 022022-03-03⋎04 >

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
09:00*qoyyuum[m] has quit (Quit: You have been kicked for being idle)
09:00*sgoodall[m] has quit (Quit: You have been kicked for being idle)
13:10jgaehring[m]interesting report:
13:10jgaehring[m]www.agriculture.com/news/business/poor-o
16:21*ZaneBelkhayat[m] has joined
16:25ZaneBelkhayat[m]Hi all, I'm new to farmOS and working on the same project as Marcos Carballal, could anyone point me to documentation on 'createAsset' as a part of Quick Forms?
16:27mstenta[m]Hi Zane Belkhayat - this might help: farmos.org/development/module/quick/
16:28mstenta[m]Specifically the "Traits and helper methods" section
16:28mstenta[m]Note that these are just wrappers around Drupal core Entity API methods - so you may be able to get more detailed docs for those....
16:28mstenta[m]www.drupal.org/docs/drupal-apis/entity-a
16:29mstenta[m]We just provide helpers to make common things easier within quick forms
16:29mstenta[m]But you can also work with the Entity API directly for full power :-)
16:30mstenta[m]Here are the traits that farmOS core provides, if you want to see what they are doing specifically: github.com/farmOS/farmOS/tree/2.x/module
16:30mstenta[m]eg, the `createAsset()` code specifically: github.com/farmOS/farmOS/blob/7014bdf953
16:31ZaneBelkhayat[m]Ahhh, thank you this is the info I was looking for!
16:31mstenta[m]it's pretty simple... it basically just passes `$values` directly into `Asset::create()` - but it also trims the title to 255 chars, links the asset to the quick form that created it automatically, and displays a message to the user with a link to the new asset
16:32mstenta[m]so if you don't want any of those things, you can bypass `createAsset()` and roll your own
16:45ZaneBelkhayat[m]Another quick question, what permissions are needed for creating an asset?
16:46mstenta[m]Each asset type will have a permission `create [type] asset`
16:46mstenta[m]eg: `create plant asset`
16:53mstenta[m]FYI @room the farmOS weekly dev call starts in ~8 minutes here: meet.jit.si/farmos-dev
16:53mstenta[m]All are welcome!
16:56mstenta[m]Zane Belkhayat: if you want to hop in and ask any questions about quick forms etc feel free! or just to listen in...
16:56mstenta[m]Marcos Carballal too :-)
16:57MarcosCarballal[Sure, happy to join
17:07symbioquine[m]I think I'm going to miss the call today... 🥺
18:00mstenta[m]@room farmOS 2.0.0-beta3 has been released! 🎉 github.com/mstenta/farmOS/releases/tag/2
20:53ZaneBelkhayat[m]So I've been wracking my brain about this all day and can't seem to figure out how to record a field through quick forms
20:59mstenta[m]Hi Zane Belkhayat what are you trying to do?
21:08ZaneBelkhayat[m]I'm trying to record a simple text field, in the asset created by a quick form, but even though the field shows up on the form, it doesn't get recorded to the created asset
21:09mstenta[m]can you share your submit method code?
21:09mstenta[m]is it a custom field you've added to the asset type? or one of the ones that comes with farmOS?
21:10ZaneBelkhayat[m]Custom field
21:11mstenta[m]are you using `createAsset()`? can you share that chunk of code so i can see it?
21:12ZaneBelkhayat[m]$this->createAsset([
21:12ZaneBelkhayat[m] 'name' => $name,
21:12ZaneBelkhayat[m] 'type' => 'producer'
21:12ZaneBelkhayat[m] ]);
21:12ZaneBelkhayat[m]Oh shoot hold on haha I edited that recently let me get back to you
21:12mstenta[m]if it's a simple single-value text field that you've added, you should be able to just do:... (full message at libera.ems.host/_matrix/media/r0/downloa)
21:13mstenta[m](that assumes that the custom field you've added to the asset is called `myfield`, and the field in your quick form is called `form_field_name`)
21:14ZaneBelkhayat[m]Yeah I got it working immediately, thank you!
21:14mstenta[m]Great!

< 022022-03-03⋏04 >