Drupal formalter for a separate teaser field


/ Published in: PHP
Save to your folder(s)

A form alter to gove Drupal a separate teaser field.


Copy this code and paste it in your HTML
  1. /**
  2.  * Implementation of hook_form_alter().
  3.  */
  4. function separate_teaser_form_alter($form_id, &$form) {
  5. if (isset($form['type']) && ($form['type']['#value'] .'_node_form' == $form_id)) {
  6. $form['teaser'] = array(
  7. '#type' => 'textarea',
  8. '#title' => t('Teaser'),
  9. '#description' => t('The teaser is used as short introduction of this post. It is displayed in all sorts of listings. If this is left empty, the system will create a teaser automatically.'),
  10. '#weight' => $weight,
  11. '#default_value' => $node->teaser,
  12. '#required' => $required,
  13. );
  14. }
  15. }

URL: http://drupal.org

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.