This project is read-only.

Custom Content Type - filtering options?

Topics: Administration, Customizing Orchard, General, Writing modules
Jul 15, 2014 at 10:13 PM

I have created a content type within my module using a migrations class:

ContentDefinitionManager.AlterTypeDefinition("Foo", Function(c)
End Function)

Once deployed I am able to create "New" Foo's from the "New" section on the menu within the administration area - this part works fine.

There are two things I want to do:
  • Create an entry in the menu on the left which lists just "Foo" content items (the "Content" menu item shows ALL content item types which is not what I want). Where would I code in the filtering aspect for this functionality?
  • In the list of "Foo" I want to show only the "Foo" content items where the currently logged in user created/owns them. I would assume it would just show all content items across the entire system.
I am slowly getting to grips with this system, so any pointers would be greatly appreciated!


Jul 17, 2014 at 3:11 PM
Edited Jul 17, 2014 at 3:11 PM
Check out the ContentAdminMenu feature of the Vandelay Industries module: That should give you exactly what you're looking for on your first point.

As far as displaying only Foo content items that the currently logged in user owns, you could remove the permission "View Foo by others", but that may have the side effect of preventing regular users of the site from viewing those items as well. You may need to create a custom controller to achieve this. I've never needed to do that myself.
Jul 17, 2014 at 9:23 PM
Hi Joshby,

Thanks very much for the info.

I'm going to check out the code in the Vandelay module on Codeplex, it seems that the INavigationProvider interface is what I want combined with a custom driver? I will give it a go and report back.

What I've actually already done is create a new role where the "Foo" (publish, edit, delete, view) "Allow" has been set - but for some reason the "View Foo By others" is only marked in "Effective" but I cannot work out how to remove this? I've been through all the other roles and it's not listed there to deselect - any ideas?

Other than that I may have to implement this somewhere else I'm guessing.

Jul 19, 2014 at 11:24 PM
Hi DankArmy,

Check dojo course, they have lesson that teaches how to add an admin menu item.