Installation of NodeOwnership worked fine. If I klick on the link to claim ownership I get following error:

The website encountered an unexpected error. Please try again later.
Recoverable fatal error: Argument 1 passed to Drupal\workbench_moderation\ModerationInformation::isModeratableEntity() must implement interface Drupal\Core\Entity\EntityInterface, string given, called in xxx/xxx.xxx.at/modules/workbench_moderation/src/Plugin/Menu/EditTab.php on line 81 and defined in Drupal\workbench_moderation\ModerationInformation->isModeratableEntity() (line 54 of modules/workbench_moderation/src/ModerationInformation.php).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MartinMa created an issue. See original summary.

myLies’s picture

looks like in EditTab class in method getRouteParameters gets entity from route
And seems like when enabled NodeOwnership in route contains entity_id but must be a entity object

I made a simple patch to check and load entity if it not an object

Status: Needs review » Needs work

The last submitted patch, 2: workbench_moderation-fix_compatible-2769119-2.patch, failed testing.

The last submitted patch, 2: workbench_moderation-fix_compatible-2769119-2.patch, failed testing.

becw’s picture

I have a similar error with the EditTab class, when I place a view at node/%node/foo. Views isn't processing the %node route placeholder into a Node object, so when EditTab looks at its "entity" property, it sees an int instead of a node object.

becw’s picture

Following up to the patch in #2, here's a version of the patch that uses dependency injection.

becw’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: workbench_moderation-edit_tab-2769119-6.patch, failed testing.

The last submitted patch, 6: workbench_moderation-edit_tab-2769119-6.patch, failed testing.

trevortwining’s picture

I've applied #6 patch and it fixes the issue for me. My issue is the same problem but a different (custom) module that creates a node/{ node }/foo path. Thanks for this, @becw ! I'm also using PHP 5.6, so I'm not sure why it's failing the 5.6 test.

Erik Frèrejean’s picture

I ran into this issue, with a view. The patch #6, resolves the issue.

scott_euser’s picture

The patch in #6 also sorts it for me. Essentially this happens with any module that adds its own local task even if using the identical format to the drupal code node module adding the version tab as far as I can tell:

core/modules/node/node.routing.yml:

entity.node.version_history:
  path: '/node/{node}/revisions'
  defaults:
    _title: 'Revisions'
    _controller: '\Drupal\node\Controller\NodeController::revisionOverview'
  requirements:
    _access_node_revision: 'view'
    node: \d+
  options:
    _node_operation_route: TRUE

node.links.task.yml

entity.node.version_history:
  route_name: entity.node.version_history
  base_route: entity.node.canonical
  title: 'Revisions'
  weight: 20
scott_euser’s picture

Status: Needs work » Needs review

Seems when requesting a retest the tests pass.

scott_euser’s picture

Status: Needs review » Reviewed & tested by the community

I've gone through the code in detail and see no issues. I don't think injecting more dependencies into the constructor would be a breaking change. After review & confirmation from 3 people that the patch solves it I am switching this to RTBC.

keboca’s picture

Patch #6 works like a charm! It solved the issue that I was facing! Thx @becw

larowlan’s picture

Should we be adding a test for this?

darvanen’s picture

+1 for commit, but yeah... this could probably use a test.
My test setup is broken atm but I'll revisit this in a couple of weeks once I find the time to get it working again.

scott_euser’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests
FileSize
5.08 KB

For my error case, this appears to have been fixed (perhaps the requirements of the constructor in core have been updated). This test would have failed below.

Perhaps someone who still has the issue can update the below test to prove failure then apply it to the patch in #6.

sivaguru_drupal’s picture

Given patches is not working for me. I am still facing this issue at workbench 8.x-1.6 while creating custom tabs in node form.