Problem/Motivation

Error: Cannot use object of type Drupal\Core\Entity\Entity\EntityFormDisplay as array in Drupal\filefield_sources\Controller\ImceController->page() (line 45 of modules/contrib/filefield_sources/src/Controller/ImceController.php).

Steps to reproduce

After enabling the module, at vanilla Drupal, access admin/structure/types/manage/article/form-display, click on the gear icon or "Widget Settings" of the image field & under "FILE SOURCES" enable "IMCE file browser" & save the configuration.

Proposed resolution

https://git.drupalcode.org/project/filefield_sources/-/blob/8.x-1.x/src/... code here should call the specific component, instead of the whole form display.

Remaining tasks

Provide a patch.

CommentFileSizeAuthor
#4 file field sources.png30.66 KBvasyok
#2 3248202-2.patch895 bytesrishi.kulshreshtha

Comments

Rishi Kulshreshtha created an issue. See original summary.

rishi.kulshreshtha’s picture

Assigned: rishi.kulshreshtha » Unassigned
Status: Active » Needs review
StatusFileSize
new895 bytes
alayham’s picture

Status: Needs review » Reviewed & tested by the community

Tested the patch in #2 and it solved the problem.
using 9.2.8 and the dev version.

vasyok’s picture

StatusFileSize
new30.66 KB

Patch worked if cheecked :
IMCE file browser settings:
Full: Browsable directories are defined by IMCE configuration profiles. File operations are allowed.

Same result obtained, when we use:
Allow users to select files from Imce File Manager for this field. - ON
Enabled sources: IMCE file browser - OFF

file field sources

aiphes’s picture

Hello,

Facing the same on D9.5.3 + filefield_sources versions : * 1.x-dev, but git provide 8.x-1.0-alpha5 with:

The website encountered an unexpected error. Please try again later.
Error: Cannot use object of type Drupal\Core\Entity\Entity\EntityFormDisplay as array in Drupal\filefield_sources\Controller\ImceController->page() (line 45 of modules/contrib/filefield_sources/src/Controller/ImceController.php).
Drupal\filefield_sources\Controller\ImceController->page('node', 'fiche_bts', 'field_detail_fiche_bts', Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 182)
Drupal\cleantalk\EventSubscriber\BootSubscriber->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 713)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Do I need to patch ?
Thanks

rschwab’s picture

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

+1 for RTBC. This fixes the error. Also changing to 2.x-dev to target D10, though this issue does still exist on the 8.x branch.

mlncn’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all! Sorry about the delay.

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.