| 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:10 | jgaehring[m] | interesting report: |
| 13:10 | jgaehring[m] | www.agriculture.com/news/business/poor-o |
| 16:21 | * | ZaneBelkhayat[m] has joined |
| 16:25 | ZaneBelkhayat[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:27 | mstenta[m] | Hi Zane Belkhayat - this might help: farmos.org/development/module/quick/ |
| 16:28 | mstenta[m] | Specifically the "Traits and helper methods" section |
| 16:28 | mstenta[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:28 | mstenta[m] | www.drupal.org/docs/drupal-apis/entity-a |
| 16:29 | mstenta[m] | We just provide helpers to make common things easier within quick forms |
| 16:29 | mstenta[m] | But you can also work with the Entity API directly for full power :-) |
| 16:30 | mstenta[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:30 | mstenta[m] | eg, the `createAsset()` code specifically: github.com/farmOS/farmOS/blob/7014bdf953 |
| 16:31 | ZaneBelkhayat[m] | Ahhh, thank you this is the info I was looking for! |
| 16:31 | mstenta[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:32 | mstenta[m] | so if you don't want any of those things, you can bypass `createAsset()` and roll your own |
| 16:45 | ZaneBelkhayat[m] | Another quick question, what permissions are needed for creating an asset? |
| 16:46 | mstenta[m] | Each asset type will have a permission `create [type] asset` |
| 16:46 | mstenta[m] | eg: `create plant asset` |
| 16:53 | mstenta[m] | FYI @room the farmOS weekly dev call starts in ~8 minutes here: meet.jit.si/farmos-dev |
| 16:53 | mstenta[m] | All are welcome! |
| 16:56 | mstenta[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:56 | mstenta[m] | Marcos Carballal too :-) |
| 16:57 | MarcosCarballal[ | Sure, happy to join |
| 17:07 | symbioquine[m] | I think I'm going to miss the call today... 🥺 |
| 18:00 | mstenta[m] | @room farmOS 2.0.0-beta3 has been released! 🎉 github.com/mstenta/farmOS/releases/tag/2 |
| 20:53 | ZaneBelkhayat[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:59 | mstenta[m] | Hi Zane Belkhayat what are you trying to do? |
| 21:08 | ZaneBelkhayat[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:09 | mstenta[m] | can you share your submit method code? |
| 21:09 | mstenta[m] | is it a custom field you've added to the asset type? or one of the ones that comes with farmOS? |
| 21:10 | ZaneBelkhayat[m] | Custom field |
| 21:11 | mstenta[m] | are you using `createAsset()`? can you share that chunk of code so i can see it? |
| 21:12 | ZaneBelkhayat[m] | $this->createAsset([ |
| 21:12 | ZaneBelkhayat[m] | 'name' => $name, |
| 21:12 | ZaneBelkhayat[m] | 'type' => 'producer' |
| 21:12 | ZaneBelkhayat[m] | ]); |
| 21:12 | ZaneBelkhayat[m] | Oh shoot hold on haha I edited that recently let me get back to you |
| 21:12 | mstenta[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:13 | mstenta[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:14 | ZaneBelkhayat[m] | Yeah I got it working immediately, thank you! |
| 21:14 | mstenta[m] | Great! |