Problem/Motivation

I use two rate types for different evaluations. The problem is that I cannot use a second "rate widget view field" within a view page. I get the following error.

TypeError: Cannot access offset of type string on string in Drupal\rate\Plugin\views\field\RateWidgetField->buildOptionsForm() (line 99 of /var/www/html/dev2site/web/modules/contrib/rate/src/Plugin/views/field/RateWidgetField.php).

Any idea, please...

Issue fork rate-3446708

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

Anonymous’s picture

jaydenpearly created an issue. See original summary.

aaron.ferris made their first commit to this issue’s fork.

aaron.ferris’s picture

Seems the $options['widgets'] default value is '', so on first add of the field we are trying to access keys/values that don't exist yet.

Raised an MR.

aaron.ferris’s picture

Status: Active » Needs review
aaron.ferris’s picture

Screenshots with change, with multiple rate widgets on a view.

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

Thank Aaron, it works.
+1 for RTBC

digitalore’s picture

This error is occurring again in Drupal 10.
I cannot use a second "rate widget view field" within a view page. I get the following error.

TypeError: Cannot access offset of type string on string in Drupal\rate\Plugin\views\field\RateWidgetField->render() (line 228 of /chroot/home/---/---.com/html/modules/rate/src/Plugin/views/field/RateWidgetField.php).

digitalore’s picture

Priority: Normal » Critical
Status: Reviewed & tested by the community » Needs work
aaron.ferris’s picture

StatusFileSize
new186.14 KB

@digitalore works as I would expect here, what version of Drupal?

10.2.6 here, article content type with 2 rate widgets, a view of articles with both rate widgets configured.

As per screenshot.

Feels like a separate issue, please create a new issue with steps to reproduce and more info such as Drupal version etc. Feel free to tag me in it, ill try and help.

aaron.ferris’s picture

Status: Needs work » Reviewed & tested by the community
ivnish’s picture

Version: 3.1.0 » 3.2.x-dev
Category: Support request » Bug report
Status: Reviewed & tested by the community » Needs review

  • ivnish committed a7a3adfb on 3.2.x authored by aaron.ferris
    fix: #3446708 TypeError: Cannot access offset of type string on string...
ivnish’s picture

Status: Needs review » Fixed

Thanks! Fixed

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.

Status: Fixed » Closed (fixed)

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