Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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;
Comment | File | Size | Author |
---|---|---|---|
#6 | fivestar-fatal_error_cannot_use_drupal_component_utility_string-2846828-6.patch | 521 bytes | bkhandruk |
Comments
Comment #2
bkhandruk CreditAttribution: bkhandruk commentedUsed Drupal\Component\Utility\SafeMarkup and Drupal\Component\Utility\Html classes instead of Drupal\Component\Utility\String.
Comment #3
Frank HH-germany CreditAttribution: Frank HH-germany commentedHi, 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
Comment #4
Mike.Brawley CreditAttribution: Mike.Brawley as a volunteer commentedI 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;
Comment #5
dbt102 CreditAttribution: dbt102 at BACnet Interest Group - Drupal for BACnet Interest Group - Drupal commentedthanks for the patch @rocket.man, can you please review the comments and resubmit?
Comment #6
bkhandruk CreditAttribution: bkhandruk commentedRecreated the patch. Tried to apply - applies cleanly.
Comment #7
shabana.navas CreditAttribution: shabana.navas commentedPatch works, thanks!
Comment #9
dbt102 CreditAttribution: dbt102 at BACnet Interest Group - Drupal for BACnet Interest Group - Drupal commentedThanks for patch @rocket.man, and for testing @shabana.navas
Comment #10
dbt102 CreditAttribution: dbt102 at BACnet Interest Group - Drupal for BACnet Interest Group - Drupal commented