World is now on Opti ID! Learn more

Per Nergård (MVP)
Jun 30, 2014
  4693
(7 votes)

Limit block and page types to be created only once.

In the last couple of solutions I have been involved in we have had the need to create additional tools for specific business needs.

We have often chosen too create the tools as page types to make the tools blend in with the rest of the site and be able to set access rights.

One drawback is that the tool types clutter down the create new type list. Sure it’s easy to fix via disabling “available in edit mode” and what I did might be a solution to a very small problem but it seemed like a good idea at the time Ler.

I created an interface and an initializing module. Just implement the interface returning true and the module will set the “available in edit mode” to false as soon as an item of specified content is created. To be able to create a new one the content needs to be deleted and the waste basket emptied.

You can get the code over at GitHub.

Jun 30, 2014

Comments

Petter Klang
Petter Klang Jul 1, 2014 08:20 AM

Interesting concept. Haven't run across the need for it yet but will keep it in mind if it comes up!

Martin Pickering
Martin Pickering Jul 1, 2014 11:16 AM

Hey, I like this sideways glance at a interesting issue.
Thanks very much for taking the time to share it with us.
M

Jul 1, 2014 02:45 PM

I liked the idea. In many sites, there are pagetypes that should exist only once. The frontpage springs to mind, and often we have a separate globalsettings page (instead of letting all the settings live on the startpage). There are usually a number of other pagetypes with a "should-exist-only-once" situation as well. My normal way of doing this has of course been to set the "available in edit mode" to false once the pagetype has been created.

Roland Kierkels
Roland Kierkels Aug 12, 2014 04:28 PM

How can i use this? Any documentation available or examples?

Please login to comment.
Latest blogs
Troubleshooting Optimizely Shortcuts: Why PageShortcutLink Threw an Error and the Solution

As developers working with Optimizely, we often encounter unique challenges that push us to explore the platform's depths. Recently, I tackled a...

Amit Mittal | Jul 9, 2025

Commerce 14.41 delisted from Nuget feed

We have decided to delist version 14.41 of the Commerce packages as we have discovered a bug that prevents current carts to be saved into...

Shahrukh Ikhtear | Jul 8, 2025

How Optimizely SaaS CMS Isn’t Just Another Commodity

CMS platforms these days are becoming commoditised. The modelling of most systems lends itself to automation. Giving marketers more flexibility wit...

Chuhukon | Jul 4, 2025 |

How to Set Up CI/CD Pipeline for Optimizely Frontend Hosting Using GitHub Actions

As I promised in my previous blog post about getting started with Optimizely Frontend Hosting, today I’m delivering on that promise by sharing how ...

Szymon Uryga | Jul 2, 2025

Environment-specific badges in the Optimizely CMS

Step 1: Add Environment Info to the UI Create a custom UIDescriptor and a ComponentDefinition to inject a badge into the CMS UI. using EPiServer.Sh...

Rajveer Singh | Jul 1, 2025

Boosting by published date with Relevance

Goal: To ensure that the latest published or last updated content is ranked higher in your search results, you can modify your query to include a ...

Rajveer Singh | Jul 1, 2025