Problem/Motivation

Hello project maintainers,

This is an automated issue to help make this module compatible with Drupal 10.

To read more about this effort by the Drupal Association, please read: The project update bot is being refreshed to support Drupal 10 readiness of contributed projects

Patches will periodically be added to this issue that remove Drupal 10 deprecated API uses. To stop further patches from being posted, change the status to anything other than Active, Needs review, Needs work or Reviewed and tested by the community. Alternatively, you can remove the "ProjectUpdateBotD10" tag from the issue to stop the bot from posting updates.

The patches will be posted by the Project Update Bot official user account. This account will not receive any issue credit contributions for itself or any company.

Proposed resolution

You have a few options for how to use this issue:

  1. Accept automated patches until this issue is closed

    If this issue is left open (status of Active, Needs review, Needs work or Reviewed and tested by the community) and the "ProjectUpdateBotD10" tag is left on this issue, new patches will be posted periodically if new deprecation fixes are needed.

    As the Drupal Rector project improves and is able to fix more deprecated API uses, the patches posted here will cover more of the deprecated API uses in the module.

    Patches and/or merge requests posted by others are ignored by the bot, and general human interactions in the issue do not stop the bot from posting updates, so feel free to use this issue to refine bot patches. The bot will still post new patches then if there is a change in the new generated patch compared to the patch that the bot posted last. Those changes are then up to humans to integrate.

  2. Leave open but stop new automated patches.

    If you want to use this issue as a starting point to remove deprecated API uses but then don't want new automated patches, remove the "ProjectUpdateBotD10" tag from the issue and use it like any other issue (the status does not matter then). If you want to receive automated patches again, add back the "ProjectUpdateBotD10" tag.

  3. Close it and don't use it

    If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review, Needs work and Reviewed and tested by the community) and no more automated patches will be posted here.

    If the issue is reopened, then new automated patches will be posted.

    If you are using another issue(s) to work on Drupal 10 compatibility it would be very useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the latest patch in the comments by Project Update Bot or human contributors that made it better.
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
  3. Provide feedback about how the testing went. If you can improve the patch, post an updated patch here.

Providing feedback

If there are problems with one of the patches posted by the Project Update Bot, such as it does not correctly replace a deprecation, you can file an issue in the Drupal Rector issue queue. For other issues with the bot, for instance if the issue summary created by the bot is unclear, use the Project analysis issue queue.

Command icon 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

Project Update Bot created an issue. See original summary.

project update bot’s picture

Status: Active » Needs review
StatusFileSize
new5.69 KB

This is an automated patch generated by Drupal Rector. Please see the issue summary for more details.

It is important that any automated tests available are run with this patch and that you manually test this patch.

Drupal 10 Compatibility

According to the Upgrade Status module, even with this patch, this module is not yet compatible with Drupal 10.

Currently Drupal Rector, version 0.12.0, cannot fix all Drupal 10 compatibility problems.

This patch does not update the info.yml file for Drupal 10 compatibility.

Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.

Debug info

Bot run #127

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.9
  2. palantirnet/drupal-rector: 0.12.0
project update bot’s picture

StatusFileSize
new14.19 KB
new13.26 KB

This is an automated patch generated by Drupal Rector. Please see the issue summary for more details.

It is important that any automated tests available are run with this patch and that you manually test this patch.

Drupal 10 Compatibility

According to the Upgrade Status module, even with this patch, this module is not yet compatible with Drupal 10.

Currently Drupal Rector, version 0.13.0, cannot fix all Drupal 10 compatibility problems.

This patch does not update the info.yml file for Drupal 10 compatibility.

Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.

Debug info

Bot run #139

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.24
  2. palantirnet/drupal-rector: 0.13.0
project update bot’s picture

This is an automated patch generated by Drupal Rector. Please see the issue summary for more details.

It is important that any automated tests available are run with this patch and that you manually test this patch.

Drupal 10 Compatibility

According to the Upgrade Status module, even with this patch, this module is not yet compatible with Drupal 10.

Currently Drupal Rector, version 0.13.1, cannot fix all Drupal 10 compatibility problems.

This patch does not update the info.yml file for Drupal 10 compatibility.

Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.

Debug info

Bot run #145

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.25
  2. palantirnet/drupal-rector: 0.13.1
project update bot’s picture

Issue summary: View changes
fjanate’s picture

Issue summary: View changes

Hi, I’m working on this issue as part of Drupal Global Contribution Weekend 2023 #ContributionWeekend2023

nicoloye’s picture

vince.rowe’s picture

Hi there, is there any update on when the Drupal 10 updates will be complete and made usable?

Many thanks

Carlos Romero made their first commit to this issue’s fork.

tim@lammar.be made their first commit to this issue’s fork.

project update bot’s picture

StatusFileSize
new418 bytes
new13.52 KB

This is an automated patch generated by Drupal Rector. Please see the issue summary for more details.

It is important that any automated tests available are run with this patch and that you manually test this patch.

Drupal 10 Compatibility

According to the Upgrade Status module, even with this patch, this module is not yet compatible with Drupal 10.

Currently Drupal Rector, version 0.15.1, cannot fix all Drupal 10 compatibility problems.

Therefore this patch does not update the info.yml file for Drupal 10 compatibility.

Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.

Debug info

Bot run #12554

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.35
  2. palantirnet/drupal-rector: 0.15.1
fishfree’s picture

This is the patch agaist the dev branch:

diff --git a/forms_steps.info.yml b/forms_steps.info.yml
index a2f9bea..64d849a 100644
--- a/forms_steps.info.yml
+++ b/forms_steps.info.yml
@@ -3,7 +3,7 @@ name: Forms Steps
description: 'Provides Drupal multiple forms steps capability using forms views.'
package: Forms
core: 8.x
-core_version_requirement: ^8 || ^9
+core_version_requirement: ^8 || ^9 || ^10
configure: entity.forms_steps.collection
dependencies:
- drupal:field
diff --git a/forms_steps.module b/forms_steps.module
index f2a29af..106117f 100644
--- a/forms_steps.module
+++ b/forms_steps.module
@@ -165,7 +165,7 @@ function forms_steps_entity_predelete($entity) {
// EntityQuery on Workflow entities.
$query = \Drupal::entityQuery(Workflow::ENTITY_TYPE);
$query->condition('entity_id', $entity_id);
- $workflow_entity_ids = $query->execute();
+ $workflow_entity_ids = $query->accessCheck()->execute();
if ($workflow_entity_ids) {
// Loop through results so we can load the result as an entity to delete.
foreach ($workflow_entity_ids as $workflow_entity_id) {
diff --git a/src/Controller/FormsStepsController.php b/src/Controller/FormsStepsController.php
index a89b9db..3b97c25 100644
--- a/src/Controller/FormsStepsController.php
+++ b/src/Controller/FormsStepsController.php
@@ -147,6 +147,7 @@ class FormsStepsController extends ControllerBase {
}
else {
$revision = $storage->getQuery()
+ ->accessCheck()
->condition($idKey, $_entity->entity_id->value)
->latestRevision()
->execute();
diff --git a/src/Event/StepChangeEvent.php b/src/Event/StepChangeEvent.php
index f686125..2ae2278 100644
--- a/src/Event/StepChangeEvent.php
+++ b/src/Event/StepChangeEvent.php
@@ -7,7 +7,7 @@ namespace Drupal\forms_steps\Event;
use Drupal\Core\Form\FormState;
use Drupal\forms_steps\Entity\FormsSteps;
use Drupal\forms_steps\Step;
-use Drupal\Component\EventDispatcher\Event;
+use Drupal\Contracts\EventDispatcher\Event;

/**
* Event that is fired when before we switch from one step to another.
diff --git a/src/EventSubscriber/RouteSubscriber.php b/src/EventSubscriber/RouteSubscriber.php
index dee9683..886620e 100644
--- a/src/EventSubscriber/RouteSubscriber.php
+++ b/src/EventSubscriber/RouteSubscriber.php
@@ -102,6 +102,7 @@ class RouteSubscriber extends RouteSubscriberBase {
$entity_ids = $this->entityTypeManager
->getStorage(FormsSteps::ENTITY_TYPE)
->getQuery()
+ ->accessCheck()
->execute();

// Loads of all forms steps.
diff --git a/tests/src/Functional/FormsStepsNavigationTest.php b/tests/src/Functional/FormsStepsNavigationTest.php
index d504622..e6ef25b 100644
--- a/tests/src/Functional/FormsStepsNavigationTest.php
+++ b/tests/src/Functional/FormsStepsNavigationTest.php
@@ -29,7 +29,7 @@ class FormsStepsNavigationTest extends BrowserTestBase {
*
* @var array
*/
- public static $modules = [
+ protected static $modules = [
'node',
'entity_test',
'field',
@@ -40,7 +40,7 @@ class FormsStepsNavigationTest extends BrowserTestBase {
/**
* Setup the env for current test using trait methods.
*/
- protected function setUp() {
+ protected function setUp(): void {
parent::setUp();

$this->formsStepsSetup();
@@ -65,7 +65,7 @@ class FormsStepsNavigationTest extends BrowserTestBase {
->pageTextContains($this->data['forms_steps']['steps'][1]['label']);

$value = 'This is an article Test Titre content';
- $this->drupalPostForm(NULL, [
+ $this->submitForm([
'title[0][value]' => $value,
], t('Save'));

@@ -76,7 +76,7 @@ class FormsStepsNavigationTest extends BrowserTestBase {
$this->assertSession()->pageTextContains($value);

$value2 = 'This is an article Test Titre content 2';
- $this->drupalPostForm(NULL, [
+ $this->submitForm([
'title[0][value]' => $value2,
], t('Save'));

@@ -86,7 +86,7 @@ class FormsStepsNavigationTest extends BrowserTestBase {
$this->assertStringContainsStringIgnoringCase($this->data['forms_steps']['steps'][3]['url'], $this->getUrl());

$value3 = 'This is a page Test Titre content';
- $this->drupalPostForm(NULL, [
+ $this->submitForm([
'title[0][value]' => $value3,
], t('Save'));

@@ -99,19 +99,19 @@ class FormsStepsNavigationTest extends BrowserTestBase {
$this->assertSession()->fieldValueEquals('title[0][value]', $value2);

// Access step 3.
- $this->drupalPostForm(NULL, [], 'Previous');
+ $this->submitForm([], 'Previous');
$this->assertSession()
->pageTextContains($this->data['forms_steps']['steps'][3]['label']);
$this->assertSession()->fieldValueEquals('title[0][value]', $value3);

// Access step 2.
- $this->drupalPostForm(NULL, [], 'Previous');
+ $this->submitForm([], 'Previous');
$this->assertSession()
->pageTextContains($this->data['forms_steps']['steps'][2]['label']);
$this->assertSession()->fieldValueEquals('title[0][value]', $value2);

// Access step 1.
- $this->drupalPostForm(NULL, [], 'Previous');
+ $this->submitForm([], 'Previous');
$this->assertSession()
->pageTextContains($this->data['forms_steps']['steps'][1]['label']);
$this->assertSession()->fieldValueEquals('title[0][value]', $value2);
diff --git a/tests/src/Functional/FormsStepsTest.php b/tests/src/Functional/FormsStepsTest.php
index 271dfef..89e4881 100644
--- a/tests/src/Functional/FormsStepsTest.php
+++ b/tests/src/Functional/FormsStepsTest.php
@@ -29,7 +29,7 @@ class FormsStepsTest extends BrowserTestBase {
*
* @var array
*/
- public static $modules = [
+ protected static $modules = [
'node',
'field',
'field_ui',
@@ -39,7 +39,7 @@ class FormsStepsTest extends BrowserTestBase {
/**
* Perform initial setup tasks that run before every test method.
*/
- public function setUp() {
+ public function setUp(): void {
parent::setUp();

$this->formsStepsSetup();
@@ -65,7 +65,7 @@ class FormsStepsTest extends BrowserTestBase {
);
$this->assertSession()->statusCodeEquals(200);
// Add a form mode.
- $this->drupalPostForm(NULL, [
+ $this->submitForm([
'label' => $form_display_mode['label'],
'id' => $form_display_mode['id'],
], t('Save'));
@@ -103,7 +103,7 @@ class FormsStepsTest extends BrowserTestBase {

// Activate Test Form Modes as a custom display mode.
foreach ($this->data['form_display_modes'] as $form_display_mode) {
- $this->drupalPostForm(NULL, [
+ $this->submitForm([
"display_modes_custom[${form_display_mode['id']}]" => $form_display_mode['id'],
], t('Save'));

@@ -122,7 +122,7 @@ class FormsStepsTest extends BrowserTestBase {
'form_mode_name' => $form_display_mode['id'],
]));
$this->assertSession()->statusCodeEquals(200);
- $this->drupalPostForm(NULL, [
+ $this->submitForm([
'fields[title][region]' => 'content',
'fields[body][region]' => 'hidden',
'fields[status][region]' => 'hidden',
@@ -136,7 +136,7 @@ class FormsStepsTest extends BrowserTestBase {
$this->drupalGet(Url::fromRoute('entity.forms_steps.add_form'));
$this->assertSession()->statusCodeEquals(200);
// Test the creation of a form step.
- $this->drupalPostForm(NULL, [
+ $this->submitForm([
'label' => $this->data['forms_steps']['label'],
'id' => $this->data['forms_steps']['id'],
'description' => $this->data['forms_steps']['description'],
@@ -157,7 +157,7 @@ class FormsStepsTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(200);

// Test the creation of an add step.
- $this->drupalPostForm(NULL, [
+ $this->submitForm([
'label' => $step['label'],
'id' => $step['id'],
'target_form_mode' => $step['target_form_mode'],
@@ -186,7 +186,7 @@ class FormsStepsTest extends BrowserTestBase {
->pageTextContains($this->data['forms_steps']['steps'][1]['label']);

$value = 'This is a Test Titre content';
- $this->drupalPostForm(NULL, [
+ $this->submitForm([
'title[0][value]' => $value,
], t('Save'));

diff --git a/tests/src/Kernel/KernelTestBase.php b/tests/src/Kernel/KernelTestBase.php
index 8237219..addb062 100644
--- a/tests/src/Kernel/KernelTestBase.php
+++ b/tests/src/Kernel/KernelTestBase.php
@@ -16,7 +16,7 @@ abstract class KernelTestBase {
*
* @var array
*/
- public static $modules = ['forms_steps', 'user'];
+ protected static $modules = ['forms_steps', 'user'];

/**
* Setup the env for current test using trait methods.
diff --git a/tests/src/Traits/FormsStepsTestTrait.php b/tests/src/Traits/FormsStepsTestTrait.php
index 037adc9..0761151 100644
--- a/tests/src/Traits/FormsStepsTestTrait.php
+++ b/tests/src/Traits/FormsStepsTestTrait.php
@@ -123,14 +123,10 @@ trait FormsStepsTestTrait {
);

// Add a form mode.
- $this->drupalPostForm(
- NULL,
- [
- 'label' => $form_display_mode['label'],
- 'id' => $form_display_mode['id'],
- ],
- t('Save')
- );
+ $this->submitForm([
+ 'label' => $form_display_mode['label'],
+ 'id' => $form_display_mode['id'],
+ ], t('Save'));

Role::load($this->user->getRoles()[1])
->grantPermission('use node.' . $form_display_mode['id'] . ' form mode')
@@ -162,13 +158,9 @@ trait FormsStepsTestTrait {

// Activate Test Form Modes as a custom display mode.
foreach ($this->data['form_display_modes'] as $form_display_mode) {
- $this->drupalPostForm(
- NULL,
- [
- "display_modes_custom[${form_display_mode['id']}]" => $form_display_mode['id'],
- ],
- t('Save')
- );
+ $this->submitForm([
+ "display_modes_custom[${form_display_mode['id']}]" => $form_display_mode['id'],
+ ], t('Save'));
}

// Configure the visible fields.
@@ -182,33 +174,25 @@ trait FormsStepsTestTrait {
)
);

- $this->drupalPostForm(
- NULL,
- [
- 'fields[title][region]' => 'content',
- 'fields[body][region]' => 'hidden',
- 'fields[status][region]' => 'hidden',
- 'fields[uid][region]' => 'hidden',
- 'fields[created][region]' => 'hidden',
- 'fields[promote][region]' => 'hidden',
- 'fields[sticky][region]' => 'hidden',
- ],
- t('Save')
- );
+ $this->submitForm([
+ 'fields[title][region]' => 'content',
+ 'fields[body][region]' => 'hidden',
+ 'fields[status][region]' => 'hidden',
+ 'fields[uid][region]' => 'hidden',
+ 'fields[created][region]' => 'hidden',
+ 'fields[promote][region]' => 'hidden',
+ 'fields[sticky][region]' => 'hidden',
+ ], t('Save'));

// Access forms steps add page.
$this->drupalGet(Url::fromRoute('entity.forms_steps.add_form'));

// Test the creation of a form step.
- $this->drupalPostForm(
- NULL,
- [
- 'label' => $this->data['forms_steps']['label'],
- 'id' => $this->data['forms_steps']['id'],
- 'description' => $this->data['forms_steps']['description'],
- ],
- t('Save')
- );
+ $this->submitForm([
+ 'label' => $this->data['forms_steps']['label'],
+ 'id' => $this->data['forms_steps']['id'],
+ 'description' => $this->data['forms_steps']['description'],
+ ], t('Save'));

// Perform steps creation.
foreach ($this->data['forms_steps']['steps'] as $step) {
@@ -223,35 +207,28 @@ trait FormsStepsTestTrait {
);

// Test the creation of an add step.
- $this->drupalPostForm(
- NULL,
- [
- 'label' => $step['label'],
- 'id' => $step['id'],
- 'target_form_mode' => $step['target_form_mode'],
- 'target_entity_bundle' => $step['target_entity_bundle'],
- 'target_entity_type' => $step['target_entity_type'],
- 'url' => $step['url'],
- ],
- t('Save')
- );
+ $this->submitForm([
+ 'label' => $step['label'],
+ 'id' => $step['id'],
+ 'target_form_mode' => $step['target_form_mode'],
+ 'target_entity_bundle' => $step['target_entity_bundle'],
+ 'target_entity_type' => $step['target_entity_type'],
+ 'url' => $step['url'],
+ ], t('Save'));

if (!is_null($step['previous'])) {
- // Update step with previous label.
- $this->drupalPostForm(
- Url::fromRoute(
- 'entity.forms_steps.edit_step_form',
- [
- 'forms_steps' => $this->data['forms_steps']['id'],
- 'forms_steps_step' => $step['id'],
- ]
- ),
+ $this->drupalGet(Url::fromRoute(
+ 'entity.forms_steps.edit_step_form',
[
- 'display_previous' => TRUE,
- 'previous_label' => $step['previous'],
- ],
- t('Save')
- );
+ 'forms_steps' => $this->data['forms_steps']['id'],
+ 'forms_steps_step' => $step['id'],
+ ]
+ ));
+ // Update step with previous label.
+ $this->submitForm([
+ 'display_previous' => TRUE,
+ 'previous_label' => $step['previous'],
+ ], t('Save'));
}
}
}

ibullock made their first commit to this issue’s fork.

sumithra ramalingam’s picture

Hi, I was using this module with D9.5 and now have asked for D10 upgradation. Someone could please help me on upgrading this module with D10 compatible.

nicoloye’s picture

I'll review this issue current work status, but I won't be able to do so before DrupalCon.
If anybody wants to step up before that feel free to do so.

oadaeh’s picture

I was working on this last week, but had to rebuild my local environment, due to various problems, so that delayed me a bit.
Due to the fact that the MR is broken, I chose to manually create a patch file with all the relevant parts (and hopefully leaving out the brokenness). I did not at all investigate comment #17.
The patch does apply for me, but only to 8.x-1.x-dev, due to some incompatible changes between it and 8.x-1.5.

alina.basarabeanu’s picture

StatusFileSize
new21.05 KB

The patch from #5 works as expected on forms_steps 8.x-1.x-dev and Drupal Version 9.5.11.

artem_sylchuk’s picture

Patch from #21 applies clearly, however it includes the irrelevant part with automatted converting the ->link() to ->toLink()->toString() by rector.
Fixed that and attached the interdiff.

I tried to fix the MR, but it includes a lot of uneeded changes in commits history and it doesn't seem I can create a new branch for some reason.
So I hope patch is fine too.

oadaeh’s picture

Thanks for that @artem_sylchuk.

There are two more in src/Form/FormsStepsEditForm.php and one in src/Form/FormsStepsProgressStepEditForm.php.

artem_sylchuk’s picture

StatusFileSize
new13.56 KB
new1.03 KB

Oh, my bad.
Thanks for pointing that out @oadaeh!
Updated the patch.

spuky’s picture

Upgrade Status is finding no Issues after applying the patch...

brooke_heaton’s picture

I can confirm that patch #25 applies clean and upgrade_status no longer triggers an issue.

chucksimply’s picture

Confirming #25 works on 8.x-1.x-dev and Drupal Version 9.5.11. Can we commit to dev, and get a new official release?

chucksimply’s picture

Status: Needs review » Reviewed & tested by the community
spuky’s picture

please ignore wrong url

spuky’s picture

spuky’s picture

For anybody using this patch for D10 upgrade you also need https://www.drupal.org/project/forms_steps/issues/3377136

  • artem_sylchuk authored d64e830c on 8.x-1.x
    Issue #3287673 by ibullock, Project Update Bot, fjanate, tim@lammar.be,...
nicoloye’s picture

Status: Reviewed & tested by the community » Fixed

Patch committed to the dev branch, preparing a new D10 release.
Thanks everybody for the great work!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.