Return to Snippet

Revision: 2725
at April 7, 2007 02:58 by berkes


Updated Code
/**
 * Implementation of form_alter
 */
function example_form_alter($form_id, &$form) {
  if (isset($form['type'])) {
    if ($form['type']['#value'] .'_node_settings' == $form_id) {
      $type = $form['type']['#value'];
      $form['example'] = array(
        '#title' => t(''),
        '#type' => 'fieldset',
      );
      $form['example']['example_'. $type] = array(
        '#title' => t('Type has XXX'),
        '#type' => 'checkbox',
        '#default_value' => variable_get('example_'. $type, 0),
        '#description' => t(''),
      );
    }
  }
}

Revision: 2724
at April 5, 2007 12:08 by berkes


Initial Code
/**
 * Implementation of form_alter
 */
function example_form_alter($form_id, &$form) {
  if (isset($form['type'])) {
    if ($form['type']['#value'] .'_node_settings' == $form_id) {
      $form['example'] = array(
        '#title' => t(''),
        '#type' => 'fieldset',
      );
      $form['example']['example_'. $type] = array(
        '#title' => t('Type has XXX'),
        '#type' => 'checkbox',
        '#default_value' => variable_get('example_'. $type, 0),
        '#description' => t(''),
      );
    }
  }
}

Initial URL


Initial Description
A form alter implementation to create variables to flag certain features per node type. E.g. Show foo on blogs only: example_blog == 1;

Initial Title
Per node type flag.

Initial Tags
drupal

Initial Language
PHP