Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyItem.Picture("Item.Item") with an Entity #3189

Closed
dustinp26 opened this issue Sep 28, 2023 · 5 comments
Closed

MyItem.Picture("Item.Item") with an Entity #3189

dustinp26 opened this issue Sep 28, 2023 · 5 comments
Assignees

Comments

@dustinp26
Copy link

I'm submitting a

[x] not sure - waiting to implement perhaps?

...about

[x] Razor templating
[x] Content Types or data management

Current Behavior / Expected Behavior

Trying to do this with an entity field type that contains an image but get en error to contact iJungleBoy

@MyItem.Picture("Image.Image")

Error: System.NotImplementedException: Path support on this method is not yet supported. Ask iJungleboy at ToSic.Sxc.Data.CodeDataFactory.Field(ITypedItem parent, String name, Boolean propsRequired, String noParamOrder, Nullable`1 required)

Instructions to Reproduce the Problem

  1. Make a content type that contains a Entity
  2. Make the Entite a Content type that contains an Image Field
  3. Try and display that image using teh Picture method does not work. It does work with @MyItem.Url("Image.Image") and other ways but not Picture.

Your environment

  • 2sxc version(s): 16.07
  • Browser: all
  • DNN: all
  • Hosting platform: all
  • Language: any/all
@iJungleboy
Copy link
Contributor

Some brief background: we introduced the path notation - eg. MyItem.Get("Subitem.Grandchild.Title") for performance reasons and to make it null-safer (so if there is no Subitem set it will not throw exceptions).

The Picture API needs a bit more magic, as it needs the field as well as the parent, so this is just a bit more complex, and not implemented yet.

You can still easily do this, using

@MyItem.Child("Image").Picture("Image")

If you need null/empty checks, you can do

@if (MyItem.IsNotEmpty("Image.Image") {
  @MyItem.Child("Image").Picture("Image")
}

We'll work on this soon, as it shouldn't be too hard to implement; expect it end of October.

@iJungleboy iJungleboy self-assigned this Sep 29, 2023
@iJungleboy iJungleboy changed the title MyItem.Picture("Item.Item") with an Entity - Says Ask iJungleboy MyItem.Picture("Item.Item") with an Entity Sep 29, 2023
@iJungleboy
Copy link
Contributor

Note: TBH I never expected this to pop up so soon 😆 - awesome that you're already using it!

@dustinp26
Copy link
Author

dustinp26 commented Sep 29, 2023

This helps, thanks: @MyItem.Child("Image").Picture("Image")

Child and Parent a bit new to me so hadn't tried that. Makes perfect sense.

I really love the work you've done with 2sxc and have become quite addicted to learning and building with it and keeping our team up-to-date on the changes with it. I've built a toolbar code generator / builder for 2sxc but had not shared it yet but you might here from me soon on that to get your thoughts.

would be for community to help anyone that wants to build or customize the toolbars as they can be so powerful in ways i don't think a lot of people realize.

@iJungleboy
Copy link
Contributor

I just implemented it ;)

But it won't be released till ca. end of October, as I'm about to go on vacation and don't want to release new code rigth before ;).

@iJungleboy
Copy link
Contributor

This helps, thanks: @MyItem.Child("Image").Picture("Image")

Child and Parent a bit new to me so hadn't tried that. Makes perfect sense.

I really love the work you've done with 2sxc and have become quite addicted to learning and building with it and keeping our team up-to-date on the changes with it. I've built a toolbar code generator / builder for 2sxc but had not shared it yet but you might here from me soon on that to get your thoughts.

would be for community to help anyone that wants to build or customize the toolbars as they can be so powerful in ways i don't think a lot of people realize.

Just saw your previous post.

Thanks for the Kudos 💖

I suggest you show it at the 2sxc Meetup - I believe it's Nov. 2nd. Are you in?
Sorry if I won't see your answer till in 3 weeks ;)

@iJungleboy iJungleboy moved this from Done to Vv16.09 in 2sxc 16 Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Vv16.09
Development

No branches or pull requests

2 participants