Skip to content

A property editor for disabling Nested Content items in Umbraco

Notifications You must be signed in to change notification settings

ronaldbarendse/NestingContently

 
 

Repository files navigation

Build status NuGet release

NestingContently

Depending on who you ask, a big gap in Umbraco's Nested Content property editor is the ability to disable nested items (ie, keep them in the current editor, but turn 'em off on the front end).

There are workarounds, but for our Dear Editors, the best solution is an additional button in the header row for each nested item (Archetype fans, I see you nodding).

This editor does exactly that - adds a disable/enable toggle to the Nested Content (and Block List, for those playing on Umbraco 8.7+) header so your editors will forever be ... wait for it ... Nesting Contently.

Support

  • Umbraco 7 => Nesting Contently v1
  • Umbraco 8.1-8.6 => Nesting Contently v2
  • Umbraco 8.7+ => Nesting Contently III

Installing the wrong version won't blow up your site, it just won't work. Just kidding, it might blow up your site. Try it and let me know.

Now with extra-juicy Property Value Converters

Thanks entirely to work by Ronald Barendse, Nesting Contently now ships with three PVCs to manage conversions for the core Nesting Contently editor, and for filtering Nested Content and Block List editors.

While the above says 'ships with' it's much more a case of ships as a supporting package. Install that bundle of awesome via NuGet => install-package NestingContently.Umbraco.ValueConverters.

Introducing Nesting Contently III - with a vengeance

Umbraco 8.7 introduces the Block List editor, which takes all the best bits of Nested Content, the Grid, Doc Type Grid Editor and others, mixes in a bit of unicorn snot to stick it all together and creates a new editing paradigm. Only thing missing? A native disable button for blocks.

Fear not! Nesting Contently III got your back, friend. NC III works its magic on the Block List, to make disabling blocks as easy as something really easy. NC III also supports nested Nested Content, if you're into that kinda thing. Probably supports nested nested Nested Content too, you pervert.

NC III is a big old change of approach with respect to updating model values - it's a lot simpler, to better work with (around?) Nested Content's interesting (odd?) approach to model syncing. For Block List, it's super straight forward, which is nice, and allows NC III to support both editors from the same implementation.

Get it

Setup

  • Install this package (derp)
  • Create a new data type using the Nesting Contently editor
  • Add the data type to the Nested Content document type
  • Name it whatever you like, but ideally set the alias to umbracoNaviHide to be able to use the .IsVisible() extension when iterating the nested items. Using any other alias means you'll need to check the property value when rendering
  • Stun your content editors with your brilliance

The editor itself is not displayed when editing the nested items - it only exists to create the property on the document type.

The button is displayed in header rows for nested items containing the Nesting Contently editor, so we can have items with the disable/enable toggle, and others without, in the same Nested Content / Block List property. Cool, right?

Toggling the button modifies the parent's parent's parent's (maybe another parent) model value, and all is well.

There's no need to touch any core files, so no worries with upgrade paths being borked. Some of the implementation is a little bit dirty, but this is essentially a hack anyway, so sue me (don't though).

Drama Cabana

It's a long read, but this thread provides some background context around why this feature is (or isn't, depending on your perspective) needed in the core.

It's also an interesting insight into product and community management, contributing to OSS and the investment plenty of people have in the Umbraco ecosystem.

There may or may not be a similar thread debating the merits of a disable button in the Block List, but don't waste your time debating it, just install this bad boy and get on with your day.

About

A property editor for disabling Nested Content items in Umbraco

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 49.8%
  • JavaScript 48.3%
  • CSS 1.2%
  • HTML 0.7%