volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Multiselect in content area

Is it possible to enable multiselect to remove a range of items from a content area? Much like the multiselect on items in a promotion.

#218022
Mar 04, 2020 9:57
Vote:

Hi Hjalmar,

There is no easy way to do this, however, if you're not using personalization or display options you could use an IList<ContentReference> instead which supports mutliselect.

#218161
Mar 06, 2020 16:56

Cool, that worked!

Is it possible to make an IList<T> not look horrible in the CMS if I have many AllowedTypes?

#218255
Edited, Mar 09, 2020 13:42

Have you tried using a base class, or an interface, as argument for your AllowedTypes attribute?

#218259
Mar 09, 2020 16:13
hjalmarzetterstrom - Mar 10, 2020 11:55
Im using the basiest classes possible :P

Probably the easy (or at least easiest) option is just to hide the whole header/allowed types section. You could achieve that with the following:

Add an editor descriptor:

[EditorDescriptorRegistration(EditorDescriptorBehavior = EditorDescriptorBehavior.ExtendBase, TargetType = typeof(IList<ContentReference>), UIHint = UiHint)]
public class HideAllowedTypesEditorDescriptor : EditorDescriptor
{
    public const string UiHint = "HideAllowedTypes";

    public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
    {
        base.ModifyMetadata(metadata, attributes);
        metadata.EditorConfiguration.Add("class", "hide-header");
    }
}

Add the following to your module.config (or create it if it doesn't exist):

<?xml version="1.0" encoding="utf-8"?>
<module>
  <clientResources>
    <add name="epi-cms.widgets.base" path="~/ClientResources/Styles/HideHeader.css" resourceType="Style" />
  </clientResources>
</module>

Add the styling (should be at the path in you module.config):

.epi-content-area-wrapper.hide-header {
    padding-top: 0;
}

.epi-content-area-wrapper.hide-header .epi-content-area-header-block {
    display: none;
}

Now you can use it on any IList<ContentReference>:

[UIHint(HideAllowedTypesEditorDescriptor.UiHint)]
public virtual IList<ContentReference> Example { get; set; }
#218492
Edited, Mar 13, 2020 17:16
hjalmarzetterstrom - Mar 18, 2020 8:53
Cool!
I will try it out, thanks!
error This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.