This project is read-only.

modifying admin add/edit screens....

Topics: Administration, General, Troubleshooting
Oct 27, 2015 at 4:22 PM
I have two Blogs, "News" and "Knowledge Base", and for the most part they both share 95% of the parts/fields that make up the "BlogPost" content type. I'm in a situation where I have a custom Part that needs to be used for "News" and a different custom Part that needs to be used for "Knowledge Base" do I go about isolating those parts so that they don't show up on the other BlogPost's edit screen? I'm, in essence, wanting to have these 2 different Parts hide/show depending on whether a BlogPost for the "News" blog is being edited or the "Knowledge Base" blog.

I've tried attaching both custom Parts to the BlogPost type, but I don't see a way to hide the Part that isn't relevant for the specific blog being edited. Am I going about doing this the right way? Is there a different way to do this? Can this even be done?
Oct 28, 2015 at 1:25 PM
Yes, you essentially want to be able to specify "blog post content type" for a given "blog content type". In your case, you'd want one content type called "News" and another one called "Knowledge Base", both representing a blog type, but configured to hold their own "blog post" content type so you can configure them separately. I ran into this exact same scenario and had to decide whether to change the Blogs module to support this, or take a different approach. We decided that revamping the Lists module would make most sense, because a Blog is essentially just a Container of a given content type.

This is what I would do in your case:
  1. Create two new content types representing the "NewsItem" and "Knowledge Base Article" respectively. Attach at least the TitlePart, AutoroutePart, BodyPart (or LayoutPart) and the ContainablePart. The latter one is essential for the next step.
  2. Create two new content types, representing the "News" and "Knowledge Base" respectively. Attach TitlePart, AutoroutePart and the ContainerPart. Configure this ContainerPart to be able to hold items of type "NewsItem" and "Knowledge Base Article" for the other type.
  3. Create one "News" content item and one "Knowledge Base" content item. Both represent a list.
With this in place, you can create news items and kb articles. You probably want to configure the AutoroutePart of both containable types to generate aliases that include the path of their container, which is similar to the way aliases are generated for blog posts.
And since you're dealing with content types, you can easily attach the CommentsPart to the NewsItem and Knowledge Base Article types so that users can leave behind comments.

You'll notice the Lists feature is quite versatile. It even lets you configure the way it appears on the admin menu, adding a quick "Create News Item" and "Create Knowledge Base Article" menu item, similar to the "New Blog Post" admin menu item.
Marked as answer by macj2k on 11/2/2015 at 12:18 AM
Oct 30, 2015 at 12:42 AM
Wow! thanks for the in-depth explanation, I'll move forward with this. Also, I'll need the "News Item" and "KB Article" types to be Indexable so that they can surfaced within search results...what part do I need to attach to make that an option?
Oct 30, 2015 at 11:01 AM
You're welcome.
To make any type indexable, simply define your search indexes and then go to your content type definitions and tick the index checkboxes No special part needed.
Oct 30, 2015 at 8:42 PM
Wow! thanks for the in-depth explanation, I'll move forward with this. Also, I'll need the "News Item" and "KB Article" types to be Indexable so that they can surfaced within search results...what part do I need to attach to make that an option?

Nov 2, 2015 at 9:41 PM
Ok, so I've got this setup as much as I could. I was thinking that setting it up in the way you recommended would give me pretty much the same result as as managing a Blog and Blog Posts but it doesn't look to be quite the same. What would like to see (or should i say, my client would like to see) are (1) links for News and Knowledge Base on the left side admin menu and when clicked (2) are taken to the screen that displays a list of the "containable" items; just like when you click on a Blog on the admin menu you see a list of it's blog posts. Also, since I'm only going to have 1 "News" instance would it be possible to configure the "Member of" field/property to default to that instance so my client doesn't have to set that for every "News Article" they create?

I see there is an option to "add to admin menu" for the Container type but when I fill that out it doesn't do anything. Nothing shows up in on the admin menu.

Nov 4, 2015 at 4:20 PM
Edited Nov 4, 2015 at 4:23 PM
The requirements you describe is exactly how it should work (see below screenshot where I have a similar scenario).
Essentially I defined my custom Container content types (Biographies, Locations, Timeline, News, Spotlight and Testimonials), created a single content item for each of them (Biographies, Locations, Timeline, News & Events, Spotlight and Testimonials), and configured each of these list content items to be placed on the admin menu to the left.
The user can now quite easily add new items to each of these collections.

Unless of course I completely misunderstood. Skype me if you want (sfmskywalker).