Problem/Motivation
Often, models currently get built and published with the bpmn_io modeller. But users who can't use that modeller and want to have a look with eca_cm, we should allow importing such "foreign" models as eca_cm models.
Proposed resolution
Implement a form alter hook to add a checkbox to the eca import form and if that's checked, hook into the import process and make the necessary adjustments.
Issue fork eca_cm-3304333
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jurgenhaasThis was interesting, the ECA import function was already built in a way that allowed to make the necessary adjustments here.
Comment #4
mxh commentedCan we make this a submit button instead of a checkbox? I'm asking because you've implemented the logic into a validation handler. Using the validate callback is not the right place, it should be a submit handler instead. Using a submit button should make adding it as a submit handler instead easier.
Comment #5
jurgenhaasIt's been a deliberate decision to implement this in the validate callback. This follows the architecture of the import controller: over there, the validate function verifies if the uploaded file is valid and prepares it for further processing. The submit callback then operates on that prepared result from the validate callback.
Hooking into this process, using the validate callback gets called after the import validate and
beforethe import submit callback. Exactly what we need, whereas a submit callback here would be called after the import submit, which is too late.Changing the checkbox to its own button could be done, I just found that offering it as a setting might be more intuitive. Did you propose the button because of validate vs. submit handler or because you think otherwise, that would be better for the user?
Comment #6
mxh commentedThe first part is fine (verifying), the second is part should belong to a submission handler. Form validation may be called multiple times as when validation errors occurred, and writing or removing files within validation does not look like an idempotent operation. How would it behave when the function is called more than once?
No, just raised this because of my question in #4.
Comment #7
mxh commentedWill merge this one into 1.0.x.
Comment #9
mxh commented