Problem/Motivation

When trying to view an operation, the following error occurs:

Error: Call to a member function getTranslationFromContext() on null in Drupal\state_machine\Form\StateTransitionForm->setEntity() (line 63 of modules/contrib/state_machine/src/Form/StateTransitionForm.php).

This is due to the OperationStateTransitionForm that doesn't call the parent::create() method.

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

jsacksick created an issue. See original summary.

jsacksick’s picture

Status: Active » Needs review
krystalcode’s picture

Status: Needs review » Needs work
jsacksick’s picture

Status: Needs work » Needs review

The change introduced is compatible with both newer and older versions of State machine.
The FormBase provides an "empty" create() implementation which means if the class we are extending doesn't override the create() method, the Entity Sync implementation is still going to work.

jsacksick’s picture

  • krystalcode committed 5a04561d on 4.x
    Issue #3611112 Inherit parent create method in state transition form
    

  • krystalcode committed 5a04561d on 5.x
    Issue #3611112 Inherit parent create method in state transition form
    
krystalcode’s picture

Status: Needs review » Fixed

- You are right, the fix also brings in auto-wiring introduced in Drupal 11 - even though it is not used here.
- Type declaration in properties is not supported in PHP 7.3 that the module still supports as part of supporting Drupal 9.

Note that merging code together from different issues into one branch is not particularly helpful. For a large project like this and for my sanity in reviewing and testing, and for future review i.e. what happened where and why, MRs and commits need to be focused i.e. not squashing all sorts of different stuff together.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.