Fatal error: Call to a member function getFieldStorageDefinition() on array

Created on 16 June 2016, over 8 years ago
Updated 7 November 2024, 14 days ago

I'm not exactly sure what is going on here but I've finally managed to find a way to reproduce this error consistently.

Set up

  1. Create a content type with an image field
  2. Add an entity reference field that references "Other > Configuration > Block"
  3. Ensure you have a View on the site with a block display (e.g. "Who's Online") and that it is placed in a region

Steps

  1. Create a node and in the block entity reference field, choose your Views block (e.g. "Who's Online")
  2. Save the node - the views block should render fine
  3. Open the node for editing
  4. Upload an image in the image field
  5. The ajax should fail and you should get the error below on screen in your inspector console, failing that it might appear on node save.

Fatal error: Call to a member function getFieldStorageDefinition() on array in core/lib/Drupal/Core/Field/TypedData/FieldItemDataDefinition.php on line 66

Line 66 is return $this->fieldDefinition->getFieldStorageDefinition()->getPropertyDefinitions();.

From a bit of debugging, I can see that $this->fieldDefinition is indeed an array and contains the following: Array ( [class] => Array ( [0] => node-page-edit-form [1] => node-form ) [data-drupal-selector] => node-page-edit-form )

The above steps reproduces the error consistently for me. I've noted the following however:

  • There's no issue editing fields which do not rely on AJAX (e.g. title field)
  • You can reference regular blocks or custom block types and you won't get the error. It only happens with Views blocks afaict
  • I've used the image uploader as a simple way to trigger it, but any ajax operation on the page should trigger it.
🐛 Bug report
Status

Closed: outdated

Version

11.0 🔥

Component

field system

Created by

🇮🇪Ireland stella

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand quietone

    I tested this today on Drupal 11.x, standard install, following the steps in the Issue Summary. I did not get a fatal error when adding an image in the image field. Therefor, I am closing this as outdated.

    If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").

    Thanks!

Production build 0.71.5 2024