London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
Hi Jason,
It's using the string value, so you could update it to:
[GroupDefinitions]
public static class ContentGroupNames
{
[Display(Order = 70)]
public const string CustomPages = "Custom Pages";
}
and it will work.
Or, if you need localization, then add the following to the language XMLs:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<languages>
<language name="English" id="en">
<groups>
<custompages>Custom Pages</custompages>
</groups>
</language>
</languages>
So am I forced to use the constant value as the display value? Is the Display attribute ignored all together?
Hi again,
No—you're not actually forced to use the string value, ideally you'd use the XML approach. That's the Episerver reccomendation as per the documentation (see 'Localizing headers'):
After a quick peek in the code I can't see that it ever uses the DisplayAttribute
Name when using group definitions, but maybe I'm missing something.
I created a custom group name that I wanted some of my page types to be listed under when creating new instances. This seems to work great when the name of the group is only a single word, but friendly names with spaces are ignored. Here is an example of my group definition:
[GroupDefinitions] public static class ContentGroupNames { [Display(Name = "Custom Pages", Order = 70)] public const string CustomPages = "CustomPages"; }
At run time the name of the group shows the constant name "CustomPages", rather than the friendly name with the space from the Display attribute. These work just fine for tabs within content, but not for page or block group names.