You are here

function textimage_js_background in Textimage 5.2

Same name and namespace in other branches
  1. 6.2 textimage.module \textimage_js_background()
1 call to textimage_js_background()
textimage_js in ./textimage.module
Textimage AHAH functionality

File

./textimage.module, line 967

Code

function textimage_js_background(&$output) {
  include_once './' . drupal_get_path('module', 'textimage') . '/textimage_admin.inc';
  $form = call_user_func_array($_POST['form_id'], 'new');
  foreach (element_children($form['settings']['preview']['text']) as $key) {
    if ($key !== 'default') {
      unset($form['settings']['preview']['text'][$key]);
    }
  }
  if (is_numeric($_POST['settings']['background']['image']) && ($preset = _textimage_preset_load($_POST['settings']['background']['image']))) {
    if (!isset($form['settings']['preview']['text']['additional'])) {
      $form['settings']['preview']['text']['additional'] = array();
    }
    _textimage_js_background($form);
    while (is_numeric($preset['settings']['background']['image']) && ($preset = _textimage_preset_load($preset['settings']['background']['image']))) {
      _textimage_js_background($form);
    }
  }
  drupal_prepare_form($_POST['form_id'], $form);
  $form = form_builder($_POST['form_id'], $form);
  $output = drupal_render($form['settings']['preview']['text']);
}