You are here

function wysiwyg_user in Wysiwyg 6

Same name and namespace in other branches
  1. 5.2 wysiwyg.module \wysiwyg_user()
  2. 5 wysiwyg.module \wysiwyg_user()
  3. 6.2 wysiwyg.module \wysiwyg_user()

Implementation of hook_user().

File

./wysiwyg.module, line 503
Integrate client-side editors with Drupal.

Code

function wysiwyg_user($type, &$edit, &$user, $category = NULL) {
  if ($type == 'form' && $category == 'account') {

    // @todo http://drupal.org/node/322433
    $profile = new stdClass();
    if (isset($profile->settings['user_choose']) && $profile->settings['user_choose']) {
      $form['wysiwyg'] = array(
        '#type' => 'fieldset',
        '#title' => t('Wysiwyg Editor settings'),
        '#weight' => 10,
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['wysiwyg']['wysiwyg_status'] = array(
        '#type' => 'checkbox',
        '#title' => t('Enable editor by default'),
        '#default_value' => isset($user->wysiwyg_status) ? $user->wysiwyg_status : (isset($profile->settings['default']) ? $profile->settings['default'] : FALSE),
        '#return_value' => 1,
        '#description' => t('If enabled, rich-text editing is enabled by default in textarea fields.'),
      );
      return array(
        'wysiwyg' => $form,
      );
    }
  }
  elseif ($type == 'validate' && isset($edit['wysiwyg_status'])) {
    return array(
      'wysiwyg_status' => $edit['wysiwyg_status'],
    );
  }
}