You are here

function dnd_test_form_alter in Scald: Media Management made easy 6

Implementation of hook_form_alter().

This demonstrates how to attach Drag and Drop to a given textarea.

File

dnd/modules/dnd_test/dnd_test.module, line 28

Code

function dnd_test_form_alter(&$form, &$form_state) {
  if ($form['#id'] == 'node-form' && $form['type']['#value'] == 'page') {
    $form['body_field']['body']['#dnd-enabled'] = TRUE;
    $form['body_field']['body']['#dnd-settings'] = array(
      'drop_selector' => '#edit-body-dnd-library .drop',
      'url' => 'dnd-test/library/?json',
    );
    $form['body_field']['body']['#rows'] = 28;
  }
}