Umbraco-cms: The Insert Value dialog (template editor) is not outputting the correct markup for built in properties

Created on 9 May 2019  路  10Comments  路  Source: umbraco/Umbraco-CMS

Updated Report

The issue here is that the Query builder is not outputting the correct values for 'built in' properties like 'pageName' (which is just Model.Name) see https://github.com/umbraco/Umbraco-CMS/issues/5437#issuecomment-490871090

Same issue goes for other built in values like created date, etc...

Original Report

Rendering standard fields using Umbraco Helper does not work.

Steps to reproduce:

  • Install fresh V8 (latest - 8.0.2) and install a starter kit
  • Go to any template and insert @Model.Value("pageName") for example
  • You will see that nothing gets returned.

And this issue is with all standard field (pageName, CreateDate, level etc)
Custom fields are rendered just fine, for example @Model.Value("companyName")

Expected result

If you are rendering @Model.Value("pageName") then you'd expect that Umbraco will return the name of the specific page.

communitup-for-grabs typbug

Most helpful comment

ok, that's the bug then, i'll update the title

All 10 comments

I think this only worked sort of, in v7 because of dynamics

If you want to render the standard fields, these are available on the model as strongly typed properties. I don't think we want to take a step backwards to have non-strongly typed results with magic strings?

  • @Model.Name
  • @Model.Level
  • @Model.CreateDate
  • etc...

Strongly typed does work indeed but then I guess we would need to change the output of what Umbraco serves. If you do use the helper then it should automagically output @Model.Name instead of @Model.Value("pageName").

Just a quick note - with this syntax, there is no 'helper' :) this is just @Model is just IPublishedContent, we're just dealing with a model here.

we would need to change the output of what Umbraco serves

What are you referring to here @dzordzs ? The query builder or something? If umbraco is generating this syntax somehow then that's the issue, not the other way around

It's the one you can use in the template @Shazwazza
Insert -> Value:
image

ok, that's the bug then, i'll update the title

@Shazwazza I've just been investigating this - as far as I can see, it's not the Query Builder that is outputting incorrect markup, it's the Insert -> Value modal.

It should be a fairly simple fix to output e.g. @Model.Name for standard fields, however there is an extra challenge. Should you still be able add a default value or set a standard field to recursive? These settings rely on @Model.Value() extensions, so I think you would have to come up with a different approach to get these working for standard fields.

I'm working on a PR on this issue.

Still an issue... just test on latest stable v8, all standard settings (so models builders purelive) and the value dialog recommends @Model.Value("createDate")...if you insert that nothing happens... so ideally the insert value dialog should check the modelsbuilder setting and suggest the correct working syntax... since I imagine that for new users that just wanna take a quick spin this is confusing...

Alos would be ace, if someone with the correct permissions changes this issue to "Insert Value Dialog" instead of "Query Builder"

Would be nice if @warrenbuckley's work can be used for this https://twitter.com/warrenbuckley/status/1228292889161195520 since the base seems to be there...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

callumbwhyte picture callumbwhyte  路  3Comments

sniffdk picture sniffdk  路  3Comments

Luksor picture Luksor  路  3Comments

sofietoft picture sofietoft  路  3Comments

janvanhelvoort picture janvanhelvoort  路  4Comments