Clean Up?

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe V4.5

Is it possible to clean up unused components

Along the way I’ve created several new page types and Elemental elements that I no longer use. It presents a risk in the editors might use things we no longer want them to add and which are no longer maintained.

Simply deleting the associated controllers, classes and templates causes silverstripe to suffer a meltdown. I imagine it wants to define the classes - perhaps due to them being referenced in “archived” items or perhaps they are named in tables.

I’m not keen to hack the db directly without knowing the consequences of deleting items there.

Can anyone provide me with some guidance please?

Hi

If you just want to prevent your content editors from creating these Elements without physically removing them you could override the canCreate method on the class:

public function canCreate($member = null, $context = array())
{
  return false;
}

There are similar canEdit, canView, and canDelete methods available as well.

I actually do want to delete them. It’s just that if you remove the element files, the entire interface is broken. Is there a way to delete unused elements?