Adding weight and required field options
JuliaKM - November 16, 2007 - 21:51
| Project: | Excerpt |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
I modified the excerpt module to add an admin section where you can set the weight of the excerpt field and where you can also make the excerpt field required. This is my first patch, so please let me know what to change.
| Attachment | Size |
|---|---|
| juliakm-2007-10-18.excerpt.module.patch | 3.21 KB |

#1
Thanks for the patch, the code looks good, but part of this functionality already exists under the settings for content types. I think the 'require' feature should go there as well. I am working on adding permissions as well.
#2
In D6 would recommend doing weight with hook_content_extra_fields(). Thats a hook offerred by CCK for ordering the node form. See patch at #272335: Excerpt for Drupal 6
#3
Here's an improved version of the patch which provides default values for all content types (useful if as in the site I am working on, there's only one type that actually needs a teaser). I did some clean up of the code as well.
#4
After testing, I noticed the description of the teaser should vary depending on whether it's required or not. Patch amended.
#5
Could this patch be reviewed by someone still running D5?