Save button on all steps

Created on 22 August 2023, over 1 year ago
Updated 30 August 2023, over 1 year ago

Could be possible to have the save button in all steps on edit operation?

Could be the esenario that user only want to change one value in some step and have a save button could improved its usability in order to ommit go to all steps to save that change.

I want to know if it is possible.

If some one have a clue in order to start to work on it, i would be grateful.

✨ Feature request
Status

Closed: won't fix

Version

1.1

Component

Code

Created by

πŸ‡¨πŸ‡·Costa Rica maxmendez

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @maxmendez
  • Status changed to Closed: won't fix over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States robphillips

    Sorry, this feature request would overly complicate the already sensitive form validation system. There is a workaround, however. Use the hook system to add your own save button that sets the form as complete.

    function hook_entity_form_steps_complete_form_alter(array &$form, FormStateInterface $form_state, FieldableEntityInterface $entity, array $state) {
      $form['actions']['save_immediately'] = [
        '#type' => 'submit',
        '#name' => 'save_immediately',
        '#value' => t('Save'),
      ];
    }
    
    function hook_entity_form_steps_state_alter(array &$state, FormStateInterface $form_state, FieldableEntityInterface $entity) {
      if ($form_state->getTriggeringElement()['#name'] === 'save_immediately') {
        // Set form as complete to trigger the entity save operation.
         $state['complete'] = TRUE;
      }
    }
    

    See https://git.drupalcode.org/project/entity_form_steps/-/blob/1.x/entity_f....

  • πŸ‡¨πŸ‡·Costa Rica maxmendez

    Hi @robphillips , thanks for your answer and time, i'll work around your suggestion.

Production build 0.71.5 2024