If i try to link a file (file entity module) via entity reference with the inline entity form then there will no form showing up just the messages

Notice: Undefined property: stdClass::$fid in file_entity_access() (line 1616 of /var/www/vhosts/commercetest.malta1066.server4you.de/httpdocs/sites/all/modules/file_entity/file_entity.module).
Notice: Undefined property: stdClass::$fid in file_entity_access() (line 1616 of /var/www/vhosts/commercetest.malta1066.server4you.de/httpdocs/sites/all/modules/file_entity/file_entity.module).

Comments

TimG1’s picture

Hello!

I am getting the same behavior on reference fields that reference a File Entity. The following error appears on the /node/add/my_entity_type page that contains an entity reference field to a File Entity.

    Notice: Undefined property: stdClass::$fid in file_entity_access() (line 1616 of /sites/all/modules/contrib/file_entity/file_entity.module).
    Notice: Undefined property: stdClass::$fid in file_entity_access() (line 1616 of /sites/all/modules/contrib/file_entity/file_entity.module).
    Notice: Undefined property: stdClass::$fid in file_entity_access() (line 1616 of /sites/all/modules/contrib/file_entity/file_entity.module).
    Notice: Undefined property: stdClass::$fid in file_entity_access() (line 1616 of /sites/all/modules/contrib/file_entity/file_entity.module).
    Notice: Undefined property: stdClass::$fid in file_entity_access() (line 1616 of /sites/all/modules/contrib/file_entity/file_entity.module).
    Notice: Undefined property: stdClass::$fid in file_entity_access() (line 1616 of /sites/all/modules/contrib/file_entity/file_entity.module).

Drupal v7.31
Entity API v7.x-1.5
Entity Reference v7.x-1.1
File Entity v7.x-2.0-alpha3 and v7.x-2.x-dev (2014-Sep-10)
Inline Entity Form v7.x-1.5 and v7.x-1.x-dev (2014-Mar-22)

Thanks for reading,
-Tim

TinaRey’s picture

I think I'm having a similar problem, just that instead of showing errors, the entity form doesn't show up at all on the parent form. I found a module that works for me: https://www.drupal.org/project/file_entity_inline but this one doesn't work with the media widget.

euk’s picture

Hello!

Just heads up for those who will be fixing this...

file_entity_access() expects the second argument to be a valid file object with file ID defined, while in case of inline entity form it can be either NULL or a file type object with just two properties: $file::type and $file::is_new.

In both cases, if {...} statement on line 1603 in file_entity_access() will fail:

if (!$file && !in_array($op, array('view', 'download', 'update', 'delete', 'create'), TRUE)) {
  // If there was no file to check against, and the $op was not one of the
  // supported ones, we return access denied.
  return FALSE;
}

...

euk’s picture

Hello there!

Further investigation led me to the similar topic https://www.drupal.org/node/2312603

There is a patch that solves the notice.

However, File Entity support is still needed - the entity form doesn't show up cuz there is no controller that would display the form.

Cheers!

frob’s picture

bojanz’s picture

Status: Active » Closed (works as designed)

File entity needs to add IEF integration, not the other way around.
See #2038053: Inline entity form support for an issue in the file_entity issue queue, for example.