Media Library Picker Field Conflicts with Layout Designer

Topics: Customizing Orchard, General, Troubleshooting
Jul 20, 2015 at 10:59 AM
I want to create content type where ill have image banner and texts, i want to use layout designer for texts, but when adding input filed with media library picker field layout designer disappears.

I Cant figure out what causes this bug, does someone have any idea ?

Orchard version: v.1.9.1.0
Developer
Jul 20, 2015 at 5:34 PM
Sounds like a bug. Can you check your log files (App_Data) and see if there's anything suspicious going on, like exceptions thrown from drivers?
Sep 30, 2015 at 1:40 PM
Edited Sep 30, 2015 at 1:40 PM
I am having this EXACT issue, been racking my brain (and google searching) for about an hour now. Came here to post about it and found this thread; I'm assuming this was never fixed/addressed?

A bit of context:
  • I've created a custom ContentPart called ProductPart. It has 2 string/text fields (ProductPartRecord) and is using the MediaPickerLibraryField.
  • I've created a custom ContentType called Product. This looks identical to the "Page" content type (so it makes use of the LayoutPart) but also has the ProductPart attached as well.
  • BOTH of these are being created via a DataMigration (not within the UI).
  • When I try to go add a new Product, the Layout Shape editor does NOT appear.
  • When I I go into Content Definition -> Product (Edit) -> Placement the Layout shape editor doesn't appear there either.
That's all i can think of in terms of context, here's a link to my most recent log file (I can't post the log entry directly in here cause its too long):

http://1drv.ms/1LjS32Y

Orchard version: v.1.9.1

Happy Hunting!

PS - It's pretty crucial I get some direction on this as quickly as possible, even if it's not a "fix" or some kind of work-around. I'm expected to deliver this project soon so I would like some idea of what I can do (or say) if this isn't a quick fix. Thanks!
Developer
Sep 30, 2015 at 2:13 PM
I'll see if I can reproduce, but your error log indicates a different issue with your own view:

System.Web.HttpCompileException: c:\Dev\MyAnalyst\Modules\MyAnalyst\Views\EditorTemplates\Elements\HeroSection.cshtml(3): error CS1061: 'MyAnalyst.ViewModels.HeroSectionEditorModel' does not contain a definition for 'SelectedHeroId'
Developer
Sep 30, 2015 at 2:25 PM
I just added a MediaLibraryPickerField to the Page content type (which also has the LayoutPart attached) and it works fine. The layout editor is still there. Perhaps you can reproduce the issue on a clean Orchard installation without any custom work and provide repro steps?
Sep 30, 2015 at 2:26 PM
Edited Sep 30, 2015 at 2:27 PM
Yes, you can ignore that error.....that's something I found and fixed myself (the error was my fault, as you pointed out).

Start at the bottom of the log file and work your way up. I'd say the last 3-4 errors all have to do with the issue in question. I was going to try to clean the log file up a bit but I didn't want to risk cutting out info you might need.

Look for errors that happening on: http://localhost:63650/Admin/Contents/Create/Product Also, if you take a look at the context I provided I would imagine you would be able to reproduce it.

If you just:
  1. create a new ContentPart
  2. add the MediaLibraryPickerField to it
  3. create a new ContentType
  4. add the ContentPart from #1 AND the LayoutPart to it
I Imagine that would get you in the right spot. Also, like I mentioned earlier, my "Product" type looks exactly like a "Page" (in terms of the parts that are attached to it) with the exception of is also has a custom "ProductPart" attached to it (and that part has MediaLibraryPickerField in it).

Thanks!
Sep 30, 2015 at 2:29 PM
Edited Sep 30, 2015 at 2:29 PM
Gotcha, I'm not adding the MediaLibraryPickerField directly to the Custom Type, it's added to a Custom Part, then that Part is being added to the Custom Type.

Can you give that a try?
Developer
Sep 30, 2015 at 2:29 PM
Ah I see. I think this may have been a bug that has been fixed. What version of Orchard are you using? Perhaps you can try it out on the 1.9.x. or even dev branch?
Sep 30, 2015 at 2:37 PM
I'm running version 1.9.1.0.

I just downloaded the zip file (the build/deploy version) about 2 weeks ago.
Developer
Sep 30, 2015 at 2:42 PM
Can't repro. Can you please try either one of these:
And let me know?
Sep 30, 2015 at 2:42 PM
Edited Sep 30, 2015 at 2:43 PM
Ok, I'll give one of those a try and let you know how it goes.....
Oct 1, 2015 at 5:43 PM
That seems to have done it....I downloaded the 1.9.x.zip file and did a build from that. Also, while I was on the github site I stumbled across this same issue that was posted over there back in July:

https://github.com/OrchardCMS/Orchard/issues/5489

So it looks like you did address it back then.

Thanks!