You are here

function ueditor_settings_form in UEditor - 百度编辑器 7

Same name and namespace in other branches
  1. 7.3 editors/ueditor.inc \ueditor_settings_form()
  2. 7.2 editors/ueditor.inc \ueditor_settings_form()

Enhances the editor profile settings form for UEditor.

1 string reference to 'ueditor_settings_form'
ueditor_ueditor_editor in editors/ueditor.inc
Plugin implementation of hook_editor().

File

editors/ueditor.inc, line 63
Editor integration functions for ueditor.

Code

function ueditor_settings_form(&$form, &$form_state) {
  $settings = $form_state['wysiwyg_profile']->settings;
  $suggest = '<code>Suggested path:</code> sites/default/files/ueditor/<br>';

  // Customize config js filename.
  $form['basic']['config'] = array(
    '#type' => 'textfield',
    '#title' => t('Editor config js filename'),
    '#description' => t('The filename of config.'),
    '#default_value' => isset($settings['config']) ? $settings['config'] : 'ueditor.config.js',
    '#maxlength' => 255,
    '#required' => TRUE,
  );
  $form['basic']['zindex'] = array(
    '#type' => 'textfield',
    '#title' => t('Editor zindex'),
    '#description' => t('The official website of the default zindex 900,<br />
      and Drupal overlay module ( #overlay= page ) conflict,
      so default change from 900 to 90 or you can customize.'),
    '#default_value' => isset($settings['zindex']) ? $settings['zindex'] : 99,
    '#size' => 5,
    '#maxlength' => 4,
    '#required' => TRUE,
  );
  $form['basic']['initial_content'] = array(
    '#type' => 'textfield',
    '#title' => t('Editor initial content'),
    '#description' => t('Editor initial content, after editor loading in the textarea.'),
    '#default_value' => isset($settings['initial_content']) ? $settings['initial_content'] : '',
    '#maxlength' => 255,
  );

  // config the upload path.
  $form['basic']['path_help'] = array(
    '#markup' => implode('<br>', array(
      '%b' => '<code>%b</code> - the base URL path of the Drupal installation (<code>' . _ueditor_realpath('%b') . '</code>)',
      '%m' => '<code>%m</code> - path where the UEditor module is stored (<code>' . _ueditor_realpath('%m') . '</code>)',
      '%l' => '<code>%l</code> - path to the libraries directory (<code>' . _ueditor_realpath('%l') . '</code>)',
      '%f' => '<code>%f</code> - the Drupal file system path where the files are stored (<code>' . _ueditor_realpath('%f') . '</code>)',
      '%d' => '<code>%d</code> - the server path to the document root (<code>' . _ueditor_realpath('%d') . '</code>)',
      '%u' => '<code>%u</code> - User ID (<code>' . _ueditor_realpath('%u') . '</code>)',
      '<br>',
    )),
    '#prefix' => '<div class="region region-help"><div class="block block-system"><div class="content">',
    '#suffix' => '</div></div></div>',
  );
  $imagePath = !empty($settings['imagePath']) ? $settings['imagePath'] : '/%b%f/ueditor/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}';
  $form['basic']['uploadpath']['imagePath'] = array(
    '#type' => 'textfield',
    '#title' => t('imagePath'),
    '#default_value' => $imagePath,
    '#description' => $suggest . 'Current path:<code>' . _ueditor_realpath($imagePath) . '</code>',
  );
  $scrawlPath = !empty($settings['scrawlPath']) ? $settings['scrawlPath'] : '/%b%f/ueditor/upload/scrawl/{yyyy}{mm}{dd}/{time}{rand:6}';
  $form['basic']['uploadpath']['scrawlPath'] = array(
    '#type' => 'textfield',
    '#title' => t('scrawlPath'),
    '#default_value' => $scrawlPath,
    '#description' => $suggest . 'Current path:<code>' . _ueditor_realpath($scrawlPath) . '</code>',
  );
  $filePath = !empty($settings['filePath']) ? $settings['filePath'] : '/%b%f/ueditor/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}';
  $form['basic']['uploadpath']['filePath'] = array(
    '#type' => 'textfield',
    '#title' => t('filePath'),
    '#default_value' => $filePath,
    '#description' => $suggest . 'Current path:<code>' . _ueditor_realpath($filePath) . '</code>',
  );
  $catcherPath = !empty($settings['catcherPath']) ? $settings['catcherPath'] : '/%b%f/ueditor/upload/catcher/{yyyy}{mm}{dd}/{time}{rand:6}';
  $form['basic']['uploadpath']['catcherPath'] = array(
    '#type' => 'textfield',
    '#title' => t('catcherPath'),
    '#default_value' => $catcherPath,
    '#description' => $suggest . 'Current path:<code>' . _ueditor_realpath($catcherPath) . '</code>',
  );
  $imageManagerPath = !empty($settings['imageManagerPath']) ? $settings['imageManagerPath'] : '/%b%f/ueditor/upload/image/';
  $form['basic']['uploadpath']['imageManagerPath'] = array(
    '#type' => 'textfield',
    '#title' => t('imageManagerPath'),
    '#default_value' => $imageManagerPath,
    '#description' => $suggest . 'Current path:<code>' . _ueditor_realpath($imageManagerPath) . '</code>',
  );
  $snapscreenPath = !empty($settings['snapscreenPath']) ? $settings['snapscreenPath'] : '/%b%f/ueditor/upload/snapscreen/{yyyy}{mm}{dd}/{time}{rand:6}';
  $form['basic']['uploadpath']['snapscreenPath'] = array(
    '#type' => 'textfield',
    '#title' => t('snapscreenPath'),
    '#default_value' => $snapscreenPath,
    '#description' => $suggest . 'Current path:<code>' . _ueditor_realpath($snapscreenPath) . '</code>',
  );
  $videoPath = !empty($settings['videoPath']) ? $settings['videoPath'] : '/%b%f/ueditor/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}';
  $form['basic']['uploadpath']['videoPath'] = array(
    '#type' => 'textfield',
    '#title' => t('videoPath'),
    '#default_value' => $videoPath,
    '#description' => $suggest . 'Current path:<code>' . _ueditor_realpath($videoPath) . '</code>',
  );
  $form['basic']['uploadpath']['#element_validate'][] = 'ueditor_settings_form_validate_uploadpath';
}