I have a requirement to build a content type that has a number of fields and also the body section which is where the html goes. When new content is added using this new content type the user would enter information for all the fields (like city, state, zip, etc) and at the point of saving the content that is created is a combination of what was already inside the body section plus the fields values would go in their assigned areas within the body section. What possible ways could this be implemented? Any recommendations for modules that do the above?
-
Are you saying that the user would be inputting some sort of tokens into the body that would then be replaced with the text of the other fields? or, are you asking how to adjust the order in which fields are displayed before and/or after the body? if the latter, another approach might be to have no body at all and instead a text area field. then you could just order it amongst all the other fields any way you wanted.– JimajammaCommented May 3, 2013 at 18:53
Add a comment
|
1 Answer
I think it sounds like you want to write a node template. http://api.drupal.org/api/drupal/modules%21node%21node.tpl.php/7
Basically you are going to create a template file called node--content-type-name.tpl.php and in that template you have access to the $node object which contains fields. Then write your html and use the values from $node.
-
I realize this isn't exactly what you were asking so but there isn't really a reason to merge the fields in most cases, but if you have to do it then use this hook api.drupal.org/api/drupal/modules%21node%21node.api.php/…– lexicantCommented May 3, 2013 at 17:50