> For the complete documentation index, see [llms.txt](https://danny-englander.gitbook.io/dev-patterns/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://danny-englander.gitbook.io/dev-patterns/drupal-7/node-form-alter.md).

# Node form alter

```php
/**
 * Implements hook_form_alter().
 *
 */
function dev_patterns_form_node_form_alter(&$form, &$form_state) {

  // Switch for the node type bundle.
  switch ($form['#bundle']) {
    // Expert node type.
    case 'expert':
    // Do stuff.
      break;
      
    // Blog node type.
    case 'blog':
    // Do stuff.
      break;
   }
  }
```
