Just for a POC i was working on, Need to check weather we can restrict a Schema available only for a particular Folder "A". Means while creating component inside folder "A" that schema should populate in Schema Dropdown. If we are creating component out of folder "A" that schema should not be available in Schema Dropdown. Is this possible?
The nearest to an out of the box solution you have available is described by Alvin in the comments - and as Alvin indicates - it's not a good solution.
You could interact with the Event System and stop saving on non-permitted schemas. There are a few implementation patterns you could consider such as:
- folder metadata with, say, a category of 'locked schemas' and a list of keywords representing schemas (with the WebDAV URL contained in the keyword definition). I'd start single selection but would ensure the code works with multi-select just in case
- a config/mapping file to manage only specific schema in specific folders - this config could be generated from a text field, a structured component offering different formats of input from
key:valuetext fields to controlled lists with category keywords similar to the above
- capture the save event and then retrospectively move the component
- this isn't too helpful for an editor if they're not duly informed and you'd need to consider avoiding name conflicts with existing components and how/if you could control access to the target folder given the Event System would be moving the item (and what you would do if the user shouldn't have access) << I've only added this as something to be aware of - it's certainly not a suggestion
You could branch out and really help the editors through a GUI extension - the biggest benefit over the Event System solution alone is that editors can be 'spoon-fed' and not put through the pain of almost compelting a taks and then hitting 'save' to be told that's not allowed.
The most contentious could be to train and trust editors. To Alvin's point - adding the 'default' schema to folders often works (if the IA/content structure in general suits) as it's then a concious decision for an editor to select another content type. Further to this ensuring that editors are informed of the reasons for something often coerces compliance :)