After adding Fivestar to a content type. When you navigate to the Form display page you get the following errro.

Fatal error: Cannot use Drupal\Component\Utility\String as String because 'String' is a special class name in /DRUPAL_PATH/modules/fivestar/src/Plugin/Field/FieldWidget/SelectWidget.php on line 10

If I remove Line 10 from this file the page will load.

Line 10: use Drupal\Component\Utility\String;

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TrailWiki created an issue. See original summary.

bkhandruk’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
521 bytes

Used Drupal\Component\Utility\SafeMarkup and Drupal\Component\Utility\Html classes instead of Drupal\Component\Utility\String.

Frank HH-germany’s picture

Hi, i have the same problem on a D8-Commerce installation when i click "Manage form dissplay".
The patch dosent work.

Fatal error: Cannot use Drupal\Component\Utility\String as String because 'String' is a special class name in /xxx/xxx/xxx/htdocs/xxx/web/modules/fivestar/src/Plugin/Field/FieldWidget/SelectWidget.php on line 10

Mike.Brawley’s picture

I didn't use the Patch file, I edited the modules\fivestar\src\Plugin\Field\FieldWidget\SelectWidget.php file to include the following on line 10-13. This worked for me. Try manually editing this file. I don't know how to create patch files, but maybe the patch file isn't correct.

use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Html;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface;

dbt102’s picture

Status: Needs review » Needs work

thanks for the patch @rocket.man, can you please review the comments and resubmit?

bkhandruk’s picture

Status: Needs work » Needs review
FileSize
521 bytes

Recreated the patch. Tried to apply - applies cleanly.

shabana.navas’s picture

Status: Needs review » Reviewed & tested by the community

Patch works, thanks!

  • dbt102 committed f87d2be on 8.x-1.x authored by rocket.man
    Issue #2846828 by rocket.man, TrailWiki, dbt102, shabana.navas: Fatal...
dbt102’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for patch @rocket.man, and for testing @shabana.navas

dbt102’s picture

Status: Fixed » Closed (fixed)

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