This project is read-only.

Hide a part from the admin list

Topics: Writing modules
Nov 26, 2011 at 10:00 PM

Is there a more sophisticated way of setting the Hidden property of a content part definition to true other than through IRepository? There is no problem with that, but I'd like to know whether there is a nicer way to do this in the migrations.

Thanks in advance.

Feb 7, 2012 at 2:42 PM

For those who stumble upon this, the workaround:

        private readonly IRepository<ContentPartDefinitionRecord> _partDefinitionRepository;

        public Ctor(IRepository<ContentPartDefinitionRecord> partDefinitionRepository)
            _partDefinitionRepository = partDefinitionRepository;

        private void HidePart(string name)
            var partDefinition = _partDefinitionRepository.Fetch(p => p.Name == name).FirstOrDefault();
            partDefinition.Hidden = true;

(Code insertions seems broken.)

I'm using this for a while but still not satisfied with it, so I've opened an issue here for a feature request. Since hiding a part is a feature of the part management system it would be nice to implement a common interface so it can be easily used too.