How do I limit Node teaser to only displaying customizable form fields for one node type?

I have tried other modules for achieving this (excerpt and cck node teaser field) but none of these worked.

CommentFileSizeAuthor
#2 nodeteaser_nodetypes_disabled.patch2.23 KBkepi

Comments

emilyf’s picture

I was looking for the same thing and ended up hacking the node teaser module. Do a search for

function nodeteaser_form_alter

and then in that function you would change this line:

if (isset($form['type']) && $form_id == $form['type']['#value'] . '_node_form') {

to:
if (isset($form['type']) && $form_id == 'YOURCONTENTTYPEHERE_node_form') {

Put the name of your content type where it says 'YOURCONTENTTYPEHERE' above. You can find the correct name by going to admin/content/types and rolling over the 'edit' link of your content type.

So, if you have a content type called 'news' that you want only want the teaser to show up on, it would be:

if (isset($form['type']) && $form_id == 'news_node_form') {

BTW, I do think this would be a good feature to build in to Node Teaser module!!!

kepi’s picture

Version: 5.x-1.1 » 5.x-1.2
Assigned: Unassigned » kepi
Status: Active » Needs review
StatusFileSize
new2.23 KB

I made small enhancement which allow administrator to set disabled content types, so in your case (only one node type) just disable all nodes instead this one. I think that it is proper behavior, cause we want to have node teaser enabled by default (in case off adding new content type).

I'm not sure if it is done right way, I have no experience with drupal modules.

pioters’s picture

This patch works for me fine. Thanks