Creation of a workflow manager to manage the next and previous button.

The idea is to be able navigate on the forms steps without loosing information.

Ex:
Step 1 : Create Article Node
Step 2 : Edit Article Node in Form Mode A
Step 3 : Create Document Node
Step 4 : Edit Article Node in Form Mode
Step 5 : Go back to Step 3 (we have here to be in edit mode as node already added)
Step 6 : Go back to Step 2 (we have to ensure that we are correctly editing the correct Article)
Step 7 : Go next to Step 3 (we have to ensure that we are editing the Document node)

Without this manager, we can't mix the node types on the same forms steps which is actually a limitation of this module.

@WIP

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

HakimR created an issue. See original summary.

HakimR’s picture

Work in progress in feature/FOST-2984440 branch
Ref: https://cgit.drupalcode.org/forms_steps/log/?h=feature/FOST-2984440

HakimR’s picture

Workflows has been implemented but not used.

Branch is correctly working but need more work to close this feature.

- When on a form with required values, previous button is not working (stuck by navigator validation)
- Remove Edit and Add mode from configuration (no more required)
- Update the tests and add test for next/previous navigation

HakimR’s picture

HakimR’s picture

Assigned: HakimR » nicoloye
Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 4: Issue_#2984440_by_HakimR.patch, failed testing. View results

HakimR’s picture

HakimR’s picture

Status: Needs work » Needs review
HakimR’s picture

Any update on the review @nicoloye ?

nicoloye’s picture

I worked on it this week end a little bit, not completed yet, I'm still on it.

nicoloye’s picture

Hey Hakim,

Impressive work on this point !
I progressed in the code review, here is a small summary :

  • This module performs alteration on the node table, on my test it generated an error :
    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'node_field_data.field_forms_steps_id' in 'where clause': SELECT base_table.vid AS vid, base_table.nid AS nid FROM {node} base_table INNER JOIN {node_field_data} node_field_data ON node_field_data.nid = base_table.nid WHERE (node_field_data.field_forms_steps_id IN (:db_condition_placeholder_0)) AND (node_field_data.default_langcode IN (:db_condition_placeholder_1)); Array ( [:db_condition_placeholder_0] => [:db_condition_placeholder_1] => 1 ) in Drupal\Core\Entity\EntityStorageBase->loadByProperties() (line 504 of /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php).
    I had to fully uninstall the module and reinstall it to make it work. As we already have a few people using the module I think we should implement a hook_update_N() to make a proper transition for this branch, what do you think ?
  • In .module file you are implementing a presave hook to check the uuid presence, I guess it's because you always require one, but it's seems a bit dirty to populate the uuid before the core do. I guess this can lead to some problems with other contribs. Is there no way to delay the operations that requires it to be sure the core has already populated it instead of creating it by ourselves ?
  • I spotted a bug : when I edit a form step content type, it is not saved.
  • I'm not fan with the url containing the UUID, is this really mandatory ? I know we discussed to implement a selector to retrieve the entity of previous steps in a future version of the module, but didn't we talked about storing this info in the user storage ?
HakimR’s picture

Hi Nicolas,

I am not very confident to propose a hook_update for this new release as the difference is too huge and that the first version is not clean...

I am using an uuid per workflow and this uuid is not the one used by Drupal, it is an internal identifier.

Having the UUID in the url is a first stage, we can try to propose another solution afterward, not confident to propose it in a short delay...

Hakim

HakimR’s picture

Status: Needs review » Patch (to be ported)

  • HakimR committed 6573543 on 8.x-1.x
    Issue #2984440 by HakimR: Add a workflow manager to control next and...
HakimR’s picture

Status: Patch (to be ported) » Fixed

Merged.

nicoloye’s picture

Assigned: nicoloye » Unassigned
Status: Fixed » Closed (fixed)