You are here

function imagefield_tokens_form_alter in ImageField Tokens 5

Same name and namespace in other branches
  1. 6 imagefield_tokens.module \imagefield_tokens_form_alter()

Implementation of hook_form_alter().

File

./imagefield_tokens.module, line 10

Code

function imagefield_tokens_form_alter($form_id, &$form) {
  if (isset($form['module']) && $form['module']['#value'] == 'imagefield') {
    $ifp = array(
      'alt' => array(
        'title' => 'ALT text',
        'form_path' => &$form['widget']['alt_settings'],
      ),
      'title' => array(
        'title' => 'Title text',
        'form_path' => &$form['widget']['title_settings'],
      ),
    );
    foreach ($ifp as $name => &$field) {
      unset($field['form_path'][$name]['#suffix']);
      $field['form_path'][$name . '_tokens'] = array(
        '#type' => 'fieldset',
        '#title' => t('!title replacement patterns', array(
          '!title' => $field['title'],
        )),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
        '#description' => theme_filefield_paths_token_help(),
      );
    }
  }
}