On a vanilla D7 alpha 7 (or D7 snapshot) with the latest insert 7.x-1.x-dev snapshot, the create content page for any content type with the insert button enabled breaks, producing this warning:
Fatal error: Call to undefined function file_directory_path() in ...\sites\all\modules\insert\insert.module on line 209

Meanwhile, the edit page for any image field with the insert button enabled carries this error message:
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 167 of C:\wamp\www\includes\entity.inc).

(Pardon, please, if this is a core issue)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mallory99’s picture

Thought I'd better clarify - when I say edit page for the 'image' field, I mean in content types - manage fields.

quicksketch’s picture

Status: Active » Postponed

I've given up working on D7 modules until D7 stabilizes.

quicksketch’s picture

In the mean time, I've just removed the D7 version entirely from the project page. You can still download it by clicking "View all releases" from the project page.

florisla’s picture

Is a new version of Insert module planned now that D7 is in beta?

tsvenson’s picture

file_directory_path() is removed from Drupal 7 due to all changes to the file management.

I simply change file_directory_path() to file_default_scheme() on line 209. Then tried it with Drupal 7 beta 2 and got no errors when using insert with the default image field to the article type.

tsvenson’s picture

Status: Postponed » Needs review
FileSize
704 bytes

Hm, the patch wasn't attached...

florisla’s picture

Thanks for the patch. On Drupal 7 beta2 the insert button still does not appear on image fields. I guess I need to dig a bit further.

tsvenson’s picture

Did you enable Insert for the image field for the content type?

florisla’s picture

I didn't realize that was necessary; thanks. It's working fine now.

florisla’s picture

Component: Miscellaneous » Code
Status: Needs review » Needs work

Of the two issues described above by the original poster, the array_flip() error is still present in 7.x-1.x-alpha3 on Drupal 7 beta 2.

tsvenson’s picture

Title: Multiple errors for 7.x-1.x-dev and 7 alpha 3 » file_directory_path is removed in D7, replaced with file_default_scheme
Status: Needs work » Needs review
FileSize
1.07 KB

I found another file_directory_path that created more fatal issues with insert. Have changed that too now and attached a new patch.

Regarding the flip_array problem, it is a different issue and also a dupe of #850946: Warning after enabling Insert: Warning: array_flip(): Can only flip STRING and INTEGER values!. Thus I have changed the title to only cover the fatal error my patch is fixing.

florisla’s picture

I applied patch #11 as well. Seems to work for me. Is that enough to be able to close this issue?

tsvenson’s picture

No, I'm not the maintainer for this module. Issues with community contributed patches should only be set to fixed by the maintainer. Lets leave it like this until then.

mlncn’s picture

Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community
Issue tags: +dgd7

We can, however, set it to "reviewed & tested by the community". ;-)

Also, module breaking entire site warrants critical– and tsvenson's patch fixes it for me also.

tsvenson’s picture

@florisla and @Benjamin Melançon

Glad to hear my patch worked for you. Haven't had any problems with Insert after that so at least it got it working with D7 again.

florisla’s picture

@tsvenson

Aren't you affected by #850946: Warning after enabling Insert: Warning: array_flip(): Can only flip STRING and INTEGER values! on D7?
That's the only thing bugging me right now; will be looking into it later this week.

@quicksketch: Any plans to apply the patch in #11 to CVS?

tsvenson’s picture

@florisla

Yes, I am affected with that as well (I actually was the one originally reporting it), which I believe everyone is. It is a bug, but you can sort of work around it. Not like this one that renders both Insert and the whole site broken.

okokokok’s picture

stuen93’s picture

Did you get file_directory_path on line 28 of insert.module?

stuen93’s picture

meaning that it needs to be changed there to I believe.

tsvenson’s picture

@stuen93, yes. See patch in #11

JohnnyX’s picture

Patch #11 seems to work for me...
Will insert go on and become a release for Drupal 7?

*UPDATE*
Seems a little buggy with colorbox (and image_resize_filter) but I will give it a second try with a new installed page...
I'm searching for a upload and insert module for Drupal 7 and this module looks good. Maybe I will test also imagepicker and dragndrop_uploads again...

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed. Let's create new issues for any further changes.

Status: Fixed » Closed (fixed)
Issue tags: -dgd7

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