I attempted an upgrade from 7.0-rc1 to 7.0-rc2 and encountered an error: "EntityFieldQueryException: Field storage engine not found." I had seen this before. But now it was stopping me from doing an upgrade, so I did some research and found that in the include/entity.inc on lines 1037,1039, and 1048 the word "sql" is missing from the field name. I changed those three lines to include sql in the field name, ie storage became sql_storage. Once that was done my problem went away. If you examine the field api and the field module you'll find the field name specified as field_sql_storage. This probably isn't the total answer to the storage engine not found error. But it fixed it for me so far.

Comments

Damien Tournoud’s picture

Status:Active» Postponed (maintainer needs more info)
Issue tags:-field, -storage

You appear to be the only one to have this issue. Could you provide detailled steps to reproduce this error?

The lines you mention in entity.inc seem correct.

ParisLiakos’s picture

i got the same error which kinda destroyed my site..after changing some block positions i got this error once i clicked save:

EntityFieldQueryException: Field storage engine not found. in EntityFieldQuery->queryCallback() (line 1048 of /var/www/vhosts/open-help.org/subdomains/paris/httpdocs/includes/entity.inc).

and i am not able to browse any page on my site

Damien Tournoud’s picture

Makeitgo100, parisz: would you be ready to provide us a database dump of a site affected by this issue?

ParisLiakos’s picture

i have one ready.it's right before i update from drupal 6.19 to drupal 7rc2: http://php.vlahonick.com/paris_db.sql.gz
i can get you a fresh one tomorrow if u need it

Makeitgo100’s picture

Well. Now that I've made those changes the problem has disappeared and the site has been upgraded from rc1 to rc2. What I am saying is I'm not sure what info I can supply that will be helpful. Does a database dump as it stands now provide any help? I also don't understand the comment by somone that the field names in entity.inc look correct. If you consider the module's name is "field_sql_storage" not "field_storage", the names look wrong to me especially in light of the fact that changing them fixed my problem. Some one with a good overview of how the field API interacts with the entity include needs to look into this. It is a real error. To reproduce the error try to install rc1 on freebsd 7.1, PHP 5.2.10, Apache 2.2.11 and Mysql 5.0.84 and then upgrade it to rc2. I hope this helps. If you need it I'll dump the DB as it is and send it to you.

Damien Tournoud’s picture

As previously stated, the code is correct, and I just cannot reproduce this with parisz database.

Makeitgo100’s picture

Damien, I thought about what you stated regarding the code being correct. So, I deleted all code and dropped the database and reinstalled rc2 from scratch with only the Media module and it's dependencies and all worked well. So, I am now concluding that one of the gallery modules I had installed before must be the reason for the strange way my install was working. I noticed that when the gallery module in question was disabled that some how it inserted it's name into one of my urls when working with the Media modules causing a white screen of death. The system is working better now so you can close this.

Branjawn’s picture

Status:Postponed (maintainer needs more info)» Active

I'm a bit confused, I was getting this same error, and I checked my database and the storage type and storage module are both "field_sql_storage". Is this not a problem?

dourouc05’s picture

Version:7.0-rc2» 7.0

I had exactly the same problem, with Drupal 7.0, the final release. I'm using SQLite3. The only solution I found was to add an "exit;" on line 1037. What an ugly hack. But that works...

adam_b’s picture

I've had this error also:
EntityFieldQueryException: Field storage engine not found. in EntityFieldQuery->queryCallback() (line 1048 of /home/adambro3/public_html/adam-browne/includes/entity.inc).

The reference page is /admin/modules/list/confirm?render=overlay - ie it's happening when I try and display the module page.

I'm using plain old MySQL - the only thing I can think of is that it might be connected to an error I found with the Media Gallery module - #1011042: Errors when enabled in Drupal 7

mrandr’s picture

Hello, I'm a newbie and desperately trying to figure my way around Drupal. Just want to chime in that I think adam_b is correct. I had

- the "Field storage engine missing" error;
- a very long list of "Notice: Undefined index: custom settings in field_view_mode_settings()" messages;
- a few "Warning: in_array() expects parameter 2 to be array, null given in system_theme_settings() (line 486 of /Applications/MAMP/htdocs/drupal/modules/system/system.admin.inc)"s;
- and, for some reason, it was refusing to use the color I'd picked for my header (using "Antonelli" theme). :(

After reading #10 and checking the link, I disabled Media Gallery as well as Entity tokens, and my site popped back to normal.

(BTW--the display error and a flood of messages occurred after I had installed the "Backup and Migrate" module, and backed up my db as well as my core files. Looking back on my recent log messages, it appears that all was peachy until I installed "Multiform" and "Media Gallery.")

Hope this is helpful to someone.

shinz83’s picture

Title:Field Storage Engine Missing» Field Storage Engine Missing - Media Gallery is an issue
Issue tags:+media gallery

Enabling the Media Gallery module wrecked the site for me. Because the error destroyed my site, I actually had to go into my cpanel and delete the Media Gallery module.

Deleting that folder/file restored my site.

Thanks, mrandr

yched’s picture

subscribe

yched’s picture

Project:Drupal core» Media Gallery
Version:7.0» 7.x-1.x-dev
Component:field system» Code

Not sure what is happening here, but bumping over to media_gallery module.

The only EntityFieldQuery performed in media_gallery happens in media_gallery_block_info.
I'm not sure what is happening here - a possible workaround for the issue would be to change the code to:

if ($field = field_info_field('media_gallery_expose_block')) {
  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'node');
  $query->entityCondition('bundle', 'media_gallery');
  $query->fieldCondition($field, 'value', 1);
  $result = $query->execute();
  if (!empty($result['node'])) {
    ...
  }
}
yched’s picture

Paragon’s picture

I'm a little confused, because I'm having this issue and I have never had the Media Gallery installed. I'll post the actual error below. The only thing that I can remember doing on my live site (the place where the error occurs) is using Backup and Migrate to download a backup sql file. Edit: It appears on every page of my site, not just the Backup and Migrate module.

-------------------

* Warning: Cannot modify header information - headers already sent by (output started at /home/paragon/public_html/includes/common.inc:2561) in drupal_send_headers() (line 1040 of /home/paragon/public_html/includes/bootstrap.inc).
* EntityFieldQueryException: Field storage engine not found. in EntityFieldQuery->queryCallback() (line 1048 of /home/paragon/public_html/includes/entity.inc).

-----------------

Paragon

mefisto75’s picture

I get: EntityFieldQueryException: Field storage engine not found. in EntityFieldQuery->queryCallback() (line 1048 of /home/ - when I try to manually run cron after installing Media Gallery
Tried to patch entity.inc didn't help, #15.
Plus: * Notice: Trying to get property of non-object in taxonomy_form_term() (line 672 of /home/v/vmallru/urban_ru/public_html/modules/taxonomy/taxonomy.admin.inc).
* Notice: Undefined index: field_name in _field_invoke() (line 189 of /home/v/vmallru/urban_ru/public_html/modules/field/field.attach.inc).

Location mysite.com/admin/config/media/galleries

blup’s picture

Having the same problem...

morleti’s picture

same problem here and no solution works... i have final Drupal 7.0 and trying to friend it with ubercart, which requires Rules, Views, Ctools, Entity API, Entity tokens modules. they work good untill Ubercart is active, but system reports me this error "EntityFieldQueryException: Field storage engine not found....", when i try to turn it on.

janeks’s picture

The same problem for me.
I have a pile of modules. I have no idea which one causes that :(
I have also the problem that I could not switch modules on/off - I am getting redirected to my admin user profile.

* Warning: Cannot modify header information - headers already sent by (output started at /.../includes/common.inc:2561) in drupal_send_headers() (line 1040 of /.../htdocs/includes/bootstrap.inc).
* EntityFieldQueryException: Field storage engine not found. in EntityFieldQuery->queryCallback() (line 1048 of /.../htdocs/includes/entity.inc).

carlbowden’s picture

I believe I have found how fix this ;-)

(xDebug and Komodo are my friends)

It works out that this is error is triggered due to not being able to find the index 'media_gallery_expose_block' in the fields array on the EntityFieldQuery object. The array is populated via the function field_info_field('media_gallery_expose_block') which can't find 'media_gallery_expose_block' but does return and empty array at index 0 of the EntityFieldQuery->fields array which is why the core entity.inc throws the error (hmm its not as bad as it sounds, its just the field_info_field function is assuming it would find data without checking its valid 1st)

I'm not sure how it got like this, my guess is the DB inserts didn't complete correctly on 1st install, I haven't tried to recreate the issue

so to fix this I used drush and disabled the 'media_gallery' module and then UNinstalled it.

You need to do a fix in the DB to reinstall it: remove the row in the {taxonomy_vocabulary} which has machine_name == gallery_collections

Then (i used drush) enable the 'media_gallery' module

then smile ;-)
(well if your problem was the same as mine you may be)

kind regards
Carl

jdleonard’s picture

I'm encountering this error on d7.0, but I've never used Media Gallery. I suspect this is a core issue.

The error is displayed strangely as well. Drupal is outputting my entire theme (Bartik) TWICE. The error only appears in the second output, which is directly below the first. The second has a title of "Error" and content of "The website encountered an unexpected error. Please try again later."

Paragon’s picture

As I have stated previously, I also have never used the media Gallery module and I have had this issue. I'm sure this issue thread is misplaced.

Paragon

jdleonard’s picture

Title:Field Storage Engine Missing - Media Gallery is an issue» Field Storage Engine Missing
Project:Media Gallery» Drupal core
Version:7.x-1.x-dev» 7.x-dev
Component:Code» field system
Priority:Normal» Major

Please move as appropriate. This seems major/critical to me. EntityFieldQuery doesn't seem to be working.

gmopinillosv’s picture

Hello there

It is not a problem of gallery. Because I didn't have installed gallery yet. It happen to me when I try to put the block about catalog on "sidebar first", so when I remove it all is fine.

Has somebody the answer? Thanks.

RaF7’s picture

subscribe

jdleonard’s picture

Priority:Major» Critical

Marking critical for visibility. Powers that be, please downgrade if appropriate.

catch’s picture

Project:Drupal core» Media Gallery
Version:7.x-dev» 7.x-1.x-dev
Component:field system» Code

I'm moving this back to Media Gallery because I can't see any sign of this bug affecting people who don't have media gallery module installed.

Have you upgraded to the latest version of media + media gallery?

ParisLiakos’s picture

When i had this error i didnt even know the media module..i just had ubercart in my drupal installation and that's all.

What i notice is that error occurs during or after upgrades.

So i dont think its related to just the Media Module but something bigger

RaF7’s picture

I'm having this issue as well, not using Media module either.

nilsx’s picture

subscribe.

same problem after the install of media_gallery module

catch’s picture

Project:Media Gallery» Drupal core
Version:7.x-1.x-dev» 8.x-dev
Component:Code» field system

OK back to core then.

If you're having this problem, and you don't have media module installed, please post a list of all enabled modules as a .txt file to this issue. You can get that list by running:

SELECT name FROM system WHERE type = 'module' AND status = 1;

(from mysql command line, or phpmyadmin or wherever).

Also, please post whether you installed Drupal prior to the 7.0 release (and if so which RC, and whether you upgraded or not) or since 7.0.

catch’s picture

Issue tags:+needs backport to D7
ParisLiakos’s picture

Well, this occurred to me a few months ago so i cant help much:P
I was upgrading an Ubercart site from drupal 6.19 to 7.0rc2.
My modules? ubercart and its dependencies
CCK
FileField
ImageAPI
ImageAPI, ImageAPI GD2
ImageCache
ImageField

Hmm i will try to find a backup so i can provide exact versions but i seriously doubt it.

I remember though that it occured to me after moving ubercart's catalog block just like http://drupal.org/node/999530#comment-4320860

yched’s picture

jdleonard’s picture

Version:8.x-dev» 7.x-dev
StatusFileSize
new455 bytes

Moving to d7 as this is a d7 bug. Seems as though #1038030 should be d7 too. If I'm missing something about proper procedures for bug fixing, please correct my change and educate me :)

Slight typo in example SQL. Corrected:

SELECT name FROM system WHERE TYPE = 'module' AND STATUS = 1

List attached. The tbm module is custom and uses the Entity API provided by the entity module to define custom entities.

Installed fresh 7.x-dev core ~4/7/11 (after 7.0).

Thanks!
JD

bfroehle’s picture

Version:7.x-dev» 8.x-dev

At the moment everything seems to be getting fixed first in D8, unless it's not applicable to D7.

kenheim’s picture

I'm getting this same error. After uninstalling the media module 7.x-1.x-dev version and replacing it with the media module 7.x-1.0-beta3 version I got this error when trying to re-enable the module.

johnv’s picture

I have the same error, following this scenario:
-enable media.module 7.x-1.0-beta4 ; run update.php ; rebuild admin/config/media/rebuild_types ; no problem yet.
-enable media_gallery.module --> Fatal Error: EntityFieldQueryException: Field storage engine not found. in EntityFieldQuery->queryCallback() (line 1048 of \includes\entity.inc).
- remove the media_galery directory to get rid of the error.

Leeteq’s picture

Subscribing.

chx’s picture

Project:Drupal core» Media Gallery
Version:8.x-dev» 7.x-1.x-dev
Component:field system» Code

A vague #30 is no reason to treat this as a core bug.

keha3912’s picture

confirm an error in the message #38

jdleonard’s picture

StatusFileSize
new1.18 KB

[edit: ignore this, I'm dumb]

Attached is a module that demonstrates this issue under the simplest of circumstances.

1. Install Drupal 7.0 or 7.x-dev (I'm using MySQL 5.1)
2. Install attached module
3. Navigate to path "efq"
4. Observe error message:

EntityFieldQueryException: Field storage engine not found. in EntityFieldQuery->queryCallback() (line 1047 of C:\Users\JD\Documents\websites\d7test\includes\entity.inc).

chx’s picture

Title:Field Storage Engine Missing» EntityFieldQueryException: Field storage engine not found
Project:Media Gallery» Drupal core
Version:7.x-1.x-dev» 8.x-dev
Component:Code» field system

My friend, the module is for sure broken. ->fieldCondition('isbn', '1234567890123') -- there is no such field. What did you expect core to do? (not to mention that the entity is not fieldable) Blowing up is an adequate reaction. Mayhaps it should note that there is no such field indeed but that's a minor issue, the error message not being the most helpful in the world.

jdleonard’s picture

Well I feel stupid. I was looking for "propertyCondition" and even then I would have been wrong... Thanks for pointing that out.

yched's suggestion in #35 makes sense. I'll just leave this to the experts though... :)

catch’s picture

Project:Drupal core» Media Gallery
Version:8.x-dev» 7.x-1.x-dev
Component:field system» Code

Moving this back to media_gallery. IMO #35 handles this for core.

Starminder’s picture

subscribe

sun’s picture

Status:Active» Needs review
Issue tags:-media gallery, -needs backport to D7
StatusFileSize
new1.36 KB

Some essential pointers and quick "fixes". Not familiar enough with media/media_gallery yet to provide proper answers. Hopefully, maintainers are.

sun’s picture

StatusFileSize
new3.15 KB

Attached patch resolves the fatal error during installation of media_gallery and thus, restores at least functional behavior.

sun’s picture

Any feedback on this patch? It at least fixes installation of media_gallery.

Of course, I've noticed that further changes are required to make the module fully functional against the latest Media code again. However, might be worth to make progress in small steps?

johnv’s picture

Status:Needs review» Needs work

Alas, I applied #49, uninstalled and enabled latest versions of Media and this module+patch. This still results in WSOD:
EntityFieldQueryException: Unknown field: media_gallery_expose_block in EntityFieldQuery->fieldCondition() (line 658 of includes\entity.inc).

[Edit] The error also shows when: -enabling/disabling other modules ;- flushing the caches.

ParisLiakos’s picture

hmmm maybe you applied the patch wrong?

i tested just now (twice) and all i can see is some minor php notices.

install and uninstall works

sun’s picture

Title:EntityFieldQueryException: Field storage engine not found» Upgrade Media Gallery for Media's new File Entity (EntityFieldQueryException: Field storage engine not found)
Status:Needs work» Needs review
StatusFileSize
new4.25 KB

@rootatwc: Can you clarify on PHP notices?

Unfortunately, I wasn't able to make much progress on the overall conversion. Attached patch shows the basics, just a pointer for what needs to happen in this issue.

This means a major rewrite. :-/

sun’s picture

StatusFileSize
new4.03 KB

Removing that code in the installer instead of commenting it out. Just to don't set a wrong example of patch quality we need for this issue.

ParisLiakos’s picture

StatusFileSize
new4.93 KB
johnv’s picture

Status:Needs review» Needs work

I installed downloaded and installed MG again and tried #54. My findings are still equal as in #51. I can discard the error and try to create a Gallery. This seems to work, but getting the error on every Flush is not acceptable.

I use media 7.x-1.x-dev (2011-Apr-28). I understand people are using different version in this issue, and Media Gallery is not supposed to work with media-dev, yet. Maintainer, which version are we supposed to test?
I post my other findings here too, Risking to be off-topic, but it may help debugging. I don't know how to evaluate a php-stack, or I would investigate more:

Displaying the Config page admin/config/media/galleries gives:
- Fatal error: Cannot access empty property in C:\damp\drupal_7.x-sid_synetic\modules\field\field.attach.inc on line 198.
- Notice: Trying to get property of non-object in taxonomy_form_term() (line 672 \modules\taxonomy\taxonomy.admin.inc).
- Notice: Undefined index: field_name in _field_invoke() (line 189 of \modules\field\field.attach.inc).

Displaying the Content page admin/content/node gives:
- Notice: Undefined property: stdClass::$media_gallery_media in media_gallery_node_load() (line 198 of media_gallery.module).

Creating a Gallery in node/add/media-gallery:
- 8x Notice: Undefined index: media_gallery_{xyz} in media_gallery_form_media_gallery_node_form_alter() (line 882 of media_gallery.module).

Saving a Gallery:
- no messages

Showing the message on /content/96788:
- Notice: Undefined property: stdClass::$media_gallery_media in media_gallery_node_load() (line 198 of media_gallery.module).
- Notice: Undefined property: stdClass::$media_gallery_columns in media_gallery_view() (line 278 of media_gallery.module).
- Notice: Undefined property: stdClass::$media_gallery_rows in media_gallery_view() (line 279 of media_gallery.module).
- Warning: Division by zero in pager_default_initialize() (line 282 of \includes\pager.inc).

Did not succeed in attaching media, but I blame that upon plupload.

ryan.armstrong’s picture

sub

triple5’s picture

Please could people be more specific about the version numbers used? as far as I understand is 7.x-1.x-dev very much in flux.

shouldn't these be all alpha versions, so that at least they have a number on them, that serves as a reference, or otherwise not be discussed here but in the irc-channels?

triple5’s picture

I have found this error in Drupal 7 (stable), media_gallery 7.x-1.x-dev (from 2011-04-25) with Media 7.x-1.0-beta4 and some other modules installed. however it seems to happen only on a site, where I had media_gallery installed previously.

Cogito’s picture

with the recommended release of media gallery, and all recommended releases of required modules on a vanilla install I was getting this issue. That is, there was no HEAD element in any of my gallery pages, on any theme.

The precise version was media_gallery-7.x-1.0-beta4. Upgrading this to media_gallery-7.x-1.x-dev fixed this.

dwalker51’s picture

+1

g76’s picture

sub

perandre’s picture

sub

franklca’s picture

I had this same problem, which the Google search brought me here. Media Gallery has not been installed on this site. Just like comment #34 - I had placed the ubercart catalog block in the sidebar. I logged into PHP myadmin and searched for uc_catalog in the 'block' table then set status to '0' and deleted the value in the region field. The site is now back online.

bmx269’s picture

Sub

effulgentsia’s picture

Status:Needs work» Needs review
StatusFileSize
new42.98 KB

Apologies that it's taken this long to get a patch up. Here it is. This should allow:
- A new site install with Media dev and Media Gallery dev + this patch
- An existing site with an existing (working) gallery using Media beta4 + Media Gallery beta5 (or dev). Followed by updating Media code to dev and updating Media Gallery code to dev + this patch. Then run update.php.

Please report if you find bugs with this patch. Thanks. As always, when testing patches, do so on a test site or a copy of your real site, but not directly on your real site.

alanburke’s picture

StatusFileSize
new66.42 KB

Thanks effulgentsia,
Great to see some action on this.
The patch applied cleanly on lastest 7.x-1.x branch.
I can install the module fine.
I can create Gallery nodes.
I can add media [already on site], but they don't display properly.
media-gallery-test.jpg
Newly uploaded files display the same

alanburke’s picture

Status:Needs review» Needs work

Changing status

tiagopb’s picture

I've have many issues with Media Gallery in the past, so my site have it disabled. Today, I've created a new empty site, with all modules in the most up to date version, and Media Gallery worked fine on this brand new test site. After that, I tried to get a backup from my current prod site using backup and migrate, and after that Media Gallery started to show this error on the test site where I've restored the backup. So, I got to this page from google, and saw some other folks above complaining about this error on sites with previous version of media gallery, which comes to be about the same issue of mine.

So, I'd like some help on trying to get a backup from my old site using Backup and Migrate excluding every single item that may have relation to my old Media Gallery, so I could test it with the empty new site. I guess that as MG worked on a fresh install, maybe removing the items related to it from and old breaked install it will work.

Thanks.

effulgentsia’s picture

@alanburke: Can you post the steps for how to reproduce #67? Was this on a clean install, or updating a site initially running older versions? If a clean install, what profile did you start with, and what order did you enable modules in? Did you enable them via the UI or via drush?

alanburke’s picture

@effulgentsia
Background - I've been trying to get Media and Media Gallery working with a site I plan to upgrade from D6 to D7.
The D6 site uses the old image module, and image gallery [within the old image module] and the plan is to migrate them all to Media and Media Gallery.
Some 10,000 images to migrate! But first I need it working.
The report above was from a clean upgrade from D6.
I installed Media and Media Gallery via drush, but it turned out that my version of Media [from git] was a bit behind, so I updated to the latest in the branch, and then got Media Gallery installed via the UI.
I'm going to try one more fully clean upgrade, and then try Media latest from Dev, with Media Gallery latest from dev with this patch,
and will report back

alanburke’s picture

StatusFileSize
new45.45 KB
new16.59 KB

Got this with a clean upgrade, trying Drush en media_gallery

/.../includes/bootstrap.inc).
FieldException: Attempt to create a field of unknown type <em class="placeholder">media</em>. in field_create_field() (line 106 of /...modules/field/field.crud.inc).
Drush command terminated abnormally due to an unrecoverable error.

So I enable media gallery and media via the ui,
and got this

media-gallery-2.jpg
Media itself seems to install fine, I can browse the media it has converted from existing content within the site.

Despite that, Media Gallery seems installed, so I can try to add a new gallery.
But some of the Gallery settings seem unavailable.

media-gallery-3.jpg.jpg

Apologies for the ramblings - hope there is something in there for you of use.

Solar75’s picture

+1

resveld’s picture

I've tested media-7.x-1.x-dev (jun-29), media-gallery-7.x-1.0-beta5 and the fix in #66 and it works fine

-Ronald

yched’s picture

@effulgentsia : minor performance improvement - it seems the *_prepare_view() calls made in media_gallery_field_formatter_view() could be made in media_gallery_field_formatter_prepare_view() instead ? (the formatter_prepare_view() callback runs on multi entities, while formatter_view() runs entity by entity.) Possibly doesn't make a big difference in practice, though.

David_Rothstein’s picture

I reviewed #66 from a code perspective and thought it looked very good. (I have not yet tried to reproduce the upgrade path problems described in the last several comments, though.)

A couple of possible issues I found while reading the code, mostly minor:

  1. There are two places in the patch that look like this:
       // Get the rendered file without annoying DIV wrappers.
    -  $element['file']['#theme'] = 'media_gallery_file_field_inline';
    +  $element['file'] = array('#theme' => 'media_gallery_file_field_inline', '0' => $element['file']);

    However, in both cases, right before them is code like this:

    <?php
     
    if ($lightbox) {
       
    $element['file']['#attached']['js'][] = drupal_get_path('module', 'media_gallery') . '/colorbox-display.js';
       
    $element['file']['#attached']['library'][] = array('media_gallery', 'colorbox');
      }
    ?>

    So won't that change result in $element['file']['#attached'] getting clobbered?

  2. Regarding this change:
    +  field_attach_prepare_view('file', $files, $file_view_mode);
    +  entity_prepare_view('file', $files);

    -  // Get the view of each media entity. The Media module doesn't provide a
    -  // media_view_multiple() function, so we invoke field_attach_prepare_view(),
    -  // entity_prepare_view(), and field_attach_view() ourselves.
    -  field_attach_prepare_view('media', $media_entities, $display['type']);
    -  entity_prepare_view('media', $media_entities);
    -  foreach ($items as $delta => $media_entity) {
    -    $element[$delta] = field_attach_view('media', $media_entity, $display['type'], $langcode);
    -    // Theme the resulting media entity render array, according to the chosen
    -    // formatter. Add information needed by those theme functions.
    +  // View each file.
    +  foreach ($items as $delta => $item) {
    +    $element[$delta] = file_view($item['file'], $file_view_mode, $langcode);

    Although media_view_multiple() did not exist (as per the previous code comment), we are now using the File Entity module which does provide a file_view_multiple() function, and it seems like we could use that rather than continuing to manually invoke field_attach_prepare_view() and viewing each file individually.

    Or if I'm wrong and we can't, it would be useful to keep a code comment around explaining why, because it wasn't obvious to me from looking at it.

effulgentsia’s picture

Status:Needs work» Needs review
StatusFileSize
new2.45 KB

Media beta5 was released last week, so it would be nice to get this issue fixed and Media Gallery beta6 released as soon as possible.

With that in mind, and given the nature of the reviews since #66, I committed #66 to 7.x-1.x.

Re #75: Thanks for the tip, but how does it work if 2 gallery nodes reference the same file? If they're all prepared ahead of time, then the first gallery's view operation would unprepare the file, causing worse performance in the 2nd gallery's view operation. In any case, if someone would like to pursue this further, please open a new issue for it: it may be a nice performance improvement for pages displaying views of multiple galleries.

Re #76.1: $element['file']['#attached'] becomes $element[0]['file']['#attached']. Nothing is clobbered.

Re #76.2: This patch adds a comment for why not use file_view_multiple(). If an issue is started for #75, that would be another reason.

Re #71, #72: I'm still not clear on the exact steps to reproduce.

This patch also adds README.txt changes in preparation for a beta6 release.

David_Rothstein’s picture

Status:Needs review» Fixed

Sorry about #76.1 - I missed the fact that the code was redefining $element['file'] as a child of itself :)

I committed the improved code comment (http://drupalcode.org/project/media_gallery.git/commit/e5a2288) and will mark this issue fixed. I think if there are still upgrade bugs that can be reproduced, that's probably better as a separate issue, though we can reopen this one if necessary. Hopefully we are done here :)

As for the changes to the README.txt from #77, I'll make sure that gets merged in to the patch at #1180672: Add minimal version for media dependency that's already in progress for that issue.

cakka’s picture

Assigned:Unassigned» cakka
Status:Fixed» Active

i get this same problem

EntityFieldQueryException: Field storage engine not found. in EntityFieldQuery->queryCallback() (line 1047 of /home/shmweb/dev7c/includes/entity.inc).

webankit’s picture

+1

alanburke’s picture

Status:Active» Fixed

@cakka - Please open a new issue if still relevant.
A fix has been committed for this.

Starminder’s picture

Will the latest dev be made available? thanks

bfroehle’s picture

You can always learn git or just go to http://drupalcode.org/project/media_gallery.git/tree/refs/heads/7.x-1.x and click on snapshot.

Status:Fixed» Closed (fixed)

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