While try to enable cloning. Got this error.
syntax error, unexpected '->' (T_OBJECT_OPERATOR) in
Composer\Autoload\includeFile() (line 60 of modules/contrib/content_entity_clone/src/Plugin/content_entity_clone/FieldProcessor/EntityLabelCloneSuffix.php).

Note: this is because the code uses the nullsafe (?->) introduced by PHP 8. So the issue only occurs when using PHP < 8.

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

pradhumanjainOSL created an issue. See original summary.

pradhumanjain2311’s picture

Assigned: pradhumanjain2311 » Unassigned

@orakili
The error was fixed by removing "?" on line 62 in the following file
modules/contrib/content_entity_clone/src/Plugin/content_entity_clone/FieldProcessor/EntityLabelCloneSuffix.php

arti_parmar’s picture

Assigned: Unassigned » arti_parmar

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

orakili’s picture

Status: Active » Needs review
arti_parmar’s picture

StatusFileSize
new839 bytes

i have fixed this error with compatible drupal 9.4

orakili’s picture

@arti_parmar, thanks for the patch but it has 2 issues:

  1. getKey('label') is different from getLabel(). The former returns the name of the property that contains the entity label (ex: title for nodes or name for taxonomy terms) which is what we want the getEntityTypeLabelField() function to return. The latter (getLabel) returns the label of the entity type (ex: "Content" for nodes" or "Taxonomy terms" for taxonomy terms).
  2. The second issue is that the patch removes the return statement.

https://git.drupalcode.org/project/content_entity_clone/-/merge_requests/1 contains a working patch. If you have the chance could you kindly review it?

orakili’s picture

Issue summary: View changes
arti_parmar’s picture

StatusFileSize
new870 bytes

@orakili , i have replace the code and fixed this error on this module so plese review.

  • orakili committed d2400ccf on 1.0.x
    Issue #3318292 by arti_parmar, orakili, pradhumanjainOSL: Backward...
orakili’s picture

Status: Needs review » Fixed

New release available: 1.0.2 with the fix.

Status: Fixed » Closed (fixed)

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