czorny813 - 3 weeks ago

Hi,

How set value in field (skip field) in controller to my form when create item in DB.

Thanks.

Answer

ryanthompson - 3 weeks ago

Just set it onSaving in your builder. Just like pages module: https://github.com/anomalylabs/pages-module/blob/2.3/src/Page/Form/PageFormBuilder.php#L59

I think there is now even a setFormEntryAttribute($field, $value) available to make things even cleaner looking.

ryanthompson - 3 weeks ago

Hey! You can interact with your builder in a number of ways - one of which is setting skips (an attribute) or simply adding one:

$builder->setSkips((array)$fieldSlugs);
$builder->skipField($fieldSlug);

Do this BEFORE calling make/render/build.

czorny813 - 3 weeks ago

Thanks. I skip the field type relationhip. How i can set value in this field? Something like parent_id in papges-module.

ryanthompson - 3 weeks ago

Just set it onSaving in your builder. Just like pages module: https://github.com/anomalylabs/pages-module/blob/2.3/src/Page/Form/PageFormBuilder.php#L59

I think there is now even a setFormEntryAttribute($field, $value) available to make things even cleaner looking.

czorny813 - 3 weeks ago

I'am sorry, i'am try but i'dont know how to use that. Thanks, I will try to effect :)

czorny813 - 3 weeks ago

Working! Thanks! :)