Controlling Access to Elements

Is it possible to control what elements are available on the system - there are a number of items that we do not wish our users to have access to.

Also - can we control what attributes are exposed - we do now encourage our users to modify classes/styles etc.

Hi there,

I just replied with some relevant info on your other thread: https://theme.co/apex/forum/t/cs-elemement-development-v2-non-classic/25868

It’s possible via Settings to show V2, classic, or both. It isn’t however possible to granularly choose which elements should appear.

Is this something you plan to add - even if it was a hook to de-register elements we do not need.

It’s not something we plan to add at the moment. Here is an unofficial way you could achieve that result using some internal functions. You can add this code to functions.php of a child theme or a custom plugin.

add_action( 'cs_register_elements', 'custom_remove_elements');

function custom_remove_elements() {
  $element_manager = CS()->loadComponent('Element_Manager');
  $element_manager->unregister_element( 'button');
}

That will entirely remove the button element. To locate element names you can search our code for cornerstone_register_element. Or for a quick list of all the element names to reference you can call this function:

CS()->loadComponent('Element_Manager')->get_element_names();

This is somewhat of a heavy handed approach as it will break anywhere the element has already been used and you will see “undefined element” placeholders anytime you import a template that used one of the elements that you removed.

1 Like

Thanks - that will do the job for now.

You are most welcome. :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.