You are here

function wysiwyg_form_user_profile_form_alter in Wysiwyg 7.2

Implements hook_form_FORM_ID_alter().

File

./wysiwyg.module, line 975

Code

function wysiwyg_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
  if ($form['#user_category'] != 'account') {
    return;
  }
  $account = $form['#user'];
  $user_formats = filter_formats($account);
  $options = array();
  $options_default = array();
  foreach (wysiwyg_profile_load_all() as $format => $profile) {

    // Only show profiles that have user_choose enabled.
    if (!empty($profile->preferences['user_choose']) && isset($user_formats[$format])) {
      $options[$format] = check_plain($user_formats[$format]->name);
      if (wysiwyg_user_get_status($profile, $account)) {
        $options_default[] = $format;
      }
    }
  }
  if (!empty($options)) {
    $form['wysiwyg']['wysiwyg_status'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Text formats enabled for rich-text editing'),
      '#options' => $options,
      '#default_value' => $options_default,
    );
  }
}