0

I have written a module that creates a custom Content Entity that has a number of fields including an entity_reference field with a "file" target type. The field_ui module adds location task tabs, alongside my entity settings page, for editing field properties (good!). However, clicking on the field_ui "Manage display" tab for my custom Entity settings crashes Drupal (and not in my code). Has anyone else seen this problem? What "file" plugin is it referring to? This happens in multiple versions of Drupal (8.0.6, 8.1.1, 8.1.7):

The website encountered an unexpected error. Please try again later.

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "file" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 57 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php). Drupal\Core\Plugin\DefaultPluginManager->getDefinition('file') Drupal\Core\Field\FormatterPluginManager->createInstance('file', Array) Drupal\Core\Plugin\DefaultLazyPluginCollection->initializePlugin('file') Drupal\Component\Plugin\LazyPluginCollection->get('file') Drupal\Component\Plugin\LazyPluginCollection->getIterator() Drupal\Core\Plugin\DefaultLazyPluginCollection->getConfiguration() Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object, 1) Drupal\Core\Entity\EntityDisplayBase->preSave(Object) Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) Drupal\Core\Entity\EntityStorageBase->save(Object) Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) Drupal\Core\Entity\Entity->save() Drupal\Core\Config\Entity\ConfigEntityBase->save() Drupal\field_ui\Form\EntityDisplayFormBase->buildFieldRow(Object, Array, Object) Drupal\field_ui\Form\EntityViewDisplayEditForm->buildFieldRow(Object, Array, Object) Drupal\field_ui\Form\EntityDisplayFormBase->form(Array, Object) Drupal\Core\Entity\EntityForm->buildForm(Array, Object) call_user_func_array(Array, Array) Drupal\Core\Form\FormBuilder->retrieveForm('entity_view_display_edit_form', Object) Drupal\Core\Form\FormBuilder->buildForm(Object, Object) Drupal\Core\Controller\FormController->getContentResult(Object, Object) call_user_func_array(Array, Array) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() call_user_func_array(Object, Array) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) Stack\StackedHttpKernel->handle(Object, 1, 1) Drupal\Core\DrupalKernel->handle(Object)

0

I'm pretty sure your view display configuration there is invalid, there is no "file" formatter. There are many formatters for file fields but none is called just file, there is file_link, file_uri, file_default and many more, you have to pick the one you want.

Granted, the error handling there could be better. Feel free to open a core issue about that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.