How to edit content with Steps and not with default Form?

Created on 1 September 2021, about 3 years ago
Updated 7 August 2024, 3 months ago

Hello,
I don't read in the documentation if there is a way to enable editing content (configured to use Forms Steps), just with Forms Steps and not with the default Drupal form display.

I can see the "pending" workflows in the configuration of Forms Steps, but this is not what I am looking for. I have a Content Type with a 100s fields, divided in 5 steps. Once I've inserted a complete item (all 5 steps) the item appears in a custom form view list, but the modify button just (of course) points to the default edit URL (and edit form) and not to some custom URL of the first step.

Moreover I am unable to "build" by hand an URL to point to the editing of a particular node, using form steps. Is there such a thing?
Thanks
Walter

💬 Support request
Status

Needs review

Version

1.0

Component

User interface

Created by

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • Status changed to Needs review 5 months ago
  • 🇮🇳India rajeshreeputra Pune

    I added the hook_menu_local_tasks_alter() to modify the edit URL to local task of content to use forms steps functionality while editing. This allows users to edit content using the forms steps. Additionally, adding static patch here.

  • 🇮🇳India rajeshreeputra Pune

    Updated the patch to work with forms_steps id than content type id.

  • Super helpful. thanks

    To find the information (machine names) you'll need to create a forms instance programatically, within the Drupal Admin UI, load a 'form steps collection' .

    /admin/config/workflow/forms_steps/

    Some comments to explain where to use the forms_steps machine names

    $forms_steps_workflow = Workflow::create([
    'instance_id' => \Drupal::service('uuid')->generate(),
    'entity_type' => 'node',
    'bundle' => 'drupal_entity_name', // Machine name of the entity attaching to the form steps instance
    'entity_id' => $currently_loaded_entity->id(),
    'form_mode' => 'another_type_of_step_reference', // Form mode, another machine name referencing the step
    'forms_steps' => 'your_collection_id', // Collection ID (as used in route below), which is the machine name of these form steps.
    'step' => 'your_step_machine_name', // Machine name of step
    ]);

    $forms_steps_workflow->save();
    $instance_id = $forms_steps_workflow->instance_id->value;

    // Redirect route = {forms_steps}.{collection_id}.{step_machine_name}
    $redirect_url = Url::fromRoute('forms_steps.your_collection_id.' . 'your_step_machine_name', ['instance_id' => $instance_id])->toString();
    $response = new RedirectResponse($redirect_url);
    $response->send();

Production build 0.71.5 2024