After uploading the image in "PARAGRAPHS BROWSER SETTINGS" > "Upload image" > getting error like below:
Error: Call to a member function getFileUri() on array in paragraphs_browser_paragraph_type_form_builder() (line 125 of /var/www/html/docroot/modules/contrib/paragraphs_browser/paragraphs_browser.module)

CommentFileSizeAuthor
#6 3355760-6.patch1.96 KBdaveferrara1
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

fathimathsajila created an issue. See original summary.

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

ranjit1032002’s picture

Status: Active » Needs review

Created MR!5 for the issue mentioned, please review.
Thank You.

texas-bronius’s picture

Two cents here - - I experienced the same error uploading an image to use for Paragraphs Browser (on a D9 site), and applying the patch https://git.drupalcode.org/project/paragraphs_browser/-/merge_requests/5... from #3 above does overcome that error, but I then see another error:
```
TypeError: mb_strlen(): Argument #1 ($string) must be of type string, array given in mb_strlen() (line 333 of /app/public_html/core/lib/Drupal/Core/Form/FormValidator.php)
#0 /app/public_html/core/lib/Drupal/Core/Form/FormValidator.php(333): mb_strlen(Array)
...
```

Related or not, I don't know, but when I forgo this nice image upload method and instead plop the img right into, say, a custom themes path, I can let the image file convey with code/config: win-win!

daveferrara1’s picture

StatusFileSize
new1.96 KB

Here is a patch. the "...mb_strlen()" WSOD is because in ln333 since the #maxlength check is truthy, #value is assumed to be a string. The maxlength is set in form_alter of the module on the file field. Here is a patch that updates the file field and includes what is unmerged in the pull request that was opened to add a check for "instanceof \Drupal\file\Entity\File".

There was also another issue with the uriScheme from Issue 3284847 and this patch adds some reorg/linting at the top.

jiggli’s picture

patch on #6 worked for me!

mndonx’s picture

Status: Needs review » Reviewed & tested by the community

This patch worked for me too, thank you!

To test:
- Edited a paragraph
- Tried to upload a Paragraph Browser image (under "Paragraphs Browser Settings")
- Got the error described in the issue
- Checked to see if the image got added anyway (it did not)
- Applied the patch
- Tried uploading a paragraph browser image again
- This time it worked with no error
- Ensured that the image now appears when adding a new paragraph to a page in the Paragraph Browser

Changing status to RTBC.

serkanb’s picture

Another confirm on patch #6, works for me as well.

greggles’s picture

Version: 8.x-1.1 » 8.x-1.x-dev

Adding credit for stefvanlooveren who proposed part of the fix here before this issue was created over in #3284847: Error: Call to undefined method Drupal\Core\File\FileSystem::uriScheme() . I'm marking that as a duplicate of this one since this has more folks and fixes more issues.

greggles’s picture

@daveferrarra1 would you consider making your patch into changes in the MR?

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

yevko’s picture

MR doesn't work and produces the same error TypeError: mb_strlen(): mentioned in #5, and patch from #6 fixes the issue

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

spuky changed the visibility of the branch 8.x-1.x to hidden.

spuky’s picture

Added Patch 6 to the MR

bvoynick’s picture

bvoynick’s picture

bvoynick’s picture

bvoynick’s picture

Status: Reviewed & tested by the community » Fixed

  • bvoynick committed 38f1c4b3 on 8.x-1.x
    Issue #3355760 by stefvanlooveren, daveferrara1, ranjit1032002, texas-...

Status: Fixed » Closed (fixed)

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