var contentTypeRepository = ServiceLocator.Current.GetInstance<IContentTypeRepository>(); var contentModelUsage = ServiceLocator.Current.GetInstance<IContentModelUsage>(); var blockType = contentTypeRepository.Load<CertificationSubStepBlock>(); var allBlocks = contentModelUsage.ListContentOfContentType(blockType);
But we need just blocks which are published, and the code above retreives obsolate blocks from the trash too.
We are using this code to get all blocks:
var contentTypeRepository = ServiceLocator.Current.GetInstance<IContentTypeRepository>();
var contentModelUsage = ServiceLocator.Current.GetInstance<IContentModelUsage>();
var blockType = contentTypeRepository.Load<CertificationSubStepBlock>();
var allBlocks = contentModelUsage.ListContentOfContentType(blockType);
But we need just blocks which are published, and the code above retreives obsolate blocks from the trash too.
Can anybody help me with this?
Thanks!