Has the SendingAllowedChildrenNotification been deprecated for V14?
m
There is this event in V8->v13 called SendingAllowedChildrenNotification that allows you to use c# to hook into the building of the list of types of documents you can create under a node. I was about to suggest somebody used it in V13, as a way to stop multiple 'Site Setting' nodes from being created, but thought I'd check it was still there, and I couldn't see it in V14? is it no longer a thing?? https://github.com/umbraco/Umbraco-CMS/blob/v13/contrib/src/Umbraco.Core/Notifications/SendingAllowedChildrenNotification.cs
s
That seems to be gone indeed, along with other notifications https://github.com/umbraco/Umbraco-CMS/pull/15855
m
Is there information about how to do the equivlent in V14 lit/vite brave new world? Most of the sites I've worked on use SendingContentNotification to update model before it's sent to the editor for editing, to provide default values and fix routing issues... where have you moved my cheese too?
m
^ its also how feature flags works 😦
b
Good to know 🙂 We are using
SendingContentNotification
as well e.g. to hide tabs, groups, properties, set properties as
ReadOnly
for specific backoffice user groups, changing view/editor of existing properties when re-using model in an overlay etc. I wonder how the equivalent of this would work in v14 😁
Perhaps @Matt Brailsford @leekelleher or @Kevin Jump have tried this or any tips in the coming months 😎
l
I was a big fan of
SendingContentNotification
, I used it a lot. Currently, there isn't an equivalent in v14. I'm unsure whether it's on the roadmap (post-v14), so I think it'd be best to start a discussion on the GitHub repo to lobby support for this (or alternative solutions). The crux of it will be about finding a good balance between backoffice client & server.
m
I think ultimately most of these are going to need to become front end extension points. V14 has a much stricter separation of back end and front end concerns so when talking about tweaking visual elements displaying, I think these are going to need to controlled on the front end. Equally, observable stores are a big concept on the front end which can be thought of as a bit of a caching layer, but really these stores need to hold full models and so altering models on the server would only make sense if those changes were permanent for the current session. I think a solution will need to come between the front end store and repository layers to allow these stores to hold the full models but allow changes as it is requested for specific use cases, ie editing. Not a solution, but maybe gives a bit of insight why these have gone from the server side.
m
I've had a bit of a play with MVC Global ResultFilters... and experimented with the AllowedChildren Sending Notification that allows you to customise the DocTypes that can be created underneath a certain node depending on the current users's User Groups etc
so it works!!
but obviously a global MVC filter applies on all MVC requests globally... including the front end
I don't know if there is a better way to apply the filter only to the backoffice, with the larger sites there tends to be a separate backoffice instance, so the implementer could target this to not affect front end performance
but in theory (as all the requests in the backoffice are broken down to a well described API!
this feels like a natural way to replace the C# Sending notifications to manipulate data, provide your own Members backoffice search etc etc..
or is it madness? if I only I knew! - I could write a blog post again, I mean I can't remember my blog's password but I could use dev.to! this could be it! don't call it a comeback
m
Wonder if its possible with middleware using something like:
Copy code
app.MapWhen(
                context => context.Request.Path.Value!.Contains("endpoint", StringComparison.OrdinalIgnoreCase),
                appBranch =>
                {
                    appBranch.UseMiddleware<MyMiddleware>();
                });
app is IApplicationBuilder (this is taken from some v10 code, but not for a backoffice endpoint
m
Honestly, I wouldn’t waste my time trying to do it from the server end. I’d be looking at what could be implemented client side.
m
Yes, but it's not possible on the client side yet?
or are you saying I should jump into refactoring this bit "this: "Equally, observable stores are a big concept on the front end which can be thought of as a bit of a caching layer, but really these stores need to hold full models and so altering models on the server would only make sense if those changes were permanent for the current session"
I was genuinely excited I'd found a way 😦
m
Server should control the model imo it makes sense in a headless app, let the server dictate what a user can see. Especially when it's permissions droven
m
All business logic SHOULD be in SQL Stored Procedures, it's inevitable!
m
What to clarify my frustration here if JS is the way that's fine but my question is why remove them what's the advantage? Off to go make the GitHub discussion 🙂
m
Don't be frustrated! - I think it's fine, what I have above with global filters is fine for now... it works well... it is possible to manipulate the data coming form api's using C#, it's a good stepping stone - if you had to build a V14 site and needed to set a default value when a page is created for a property editor, 'you could' achieve that with a global mvc filter- therefore it's not deprecated, it doesn't need to be announced as a breaking change and obsoleted for a major version before it's removed - it might not be the 'right way' and as the new backoffice matures, then over time something like this might be introduced back in, if there is a need... or the use cases that people have for using these events might be analysed and priortised, and if it turns out that X% of Umbraco sites all use one of these notifications to do a specific task, eg set a default value, then the answer might not be to provide these events willy nilly, but instead, provide a way to set a default value etc todays date for a blog post etc - get things out of code and into configuration etc
d
I just stumbled on to this and added something to the discussion on github started by @Matt Wise https://github.com/umbraco/Umbraco-CMS/discussions/16329
l
I'm not happy about this 😦 I also replied in the discussion on github
r
I really hope someone from the front-end team will come with some samples how to do this in the new backoffice (since I agree with Matt this should be handled client side) . So much implementations use this technique...
126 Views