after_save logic hook - is website content still retrievable?

when I have a create-form of a custom module I would like to add some fields into the html that do not actually belong to this module but another one.

Its only like 2 or 3 fields I would have to add, it would be easy for the user if he could enter all values in a single form. I would like to retrieve the website content in an after save hook and then manually write new records of the other module to db. This requires that during hook execution it is somehow possible to retrieve the original website content to extract the information I need. Is this somehow doable?


The approach I suggest is to create some additional fields in your module, to replicate the ones in the other modules. Then put these fields in the Edit view, and people will be able to fill them.

Then in the before_save logic hook, you have those values there and you can copy them to the other modules. In the end, you can clear the values from the original module, or just leave them there.

If you want the values to diplay also in the Detail view, then I suggest a different technique - override the Detail view and grab the values from the other modules before showing. There are examples of this technique if you search:

Thanks for your reply.
Its like 3 fields but several times. Think of it like having an order “1234” and up to N positions for which each you would have to provide 3 fields each.
The position in the position module depend on the order number i.e. no position without order record. For convenience it would be nice if I just could enter everything in one go rather than switching to the position module and click N times ‘create’ there.

I would want to display 10-20 rows with 3 fields each and ignore empty lines.

Do you have any solution in mind that could work in this scenario?

Best & thx for your help

The techniques I explained above could work there.

But you are stretching the limits of what these views are supposed to do. To do this correctly you should keep be accessing the data from where it actually is, and adding the necessary view overrides and Javascript to bring all this together in a user-friendly way.

Adding a ton of new fields, and copies of these fields, will make your system look clumsy and awkward to use. But if that’s the best you can achieve, or you don’t wat to write a lot of fancy custom code, go ahead :slight_smile: