You are here

function wysiwyg_profile_overview in Wysiwyg 6

Same name and namespace in other branches
  1. 5.2 wysiwyg.admin.inc \wysiwyg_profile_overview()
  2. 5 wysiwyg.admin.inc \wysiwyg_profile_overview()
  3. 6.2 wysiwyg.admin.inc \wysiwyg_profile_overview()
  4. 7.2 wysiwyg.admin.inc \wysiwyg_profile_overview()

Display overview of setup Wysiwyg Editor profiles; menu callback.

1 string reference to 'wysiwyg_profile_overview'
wysiwyg_admin in ./wysiwyg.admin.inc
Callback handler for admin pages; menu callback.

File

./wysiwyg.admin.inc, line 383
Integrate Wysiwyg editors into Drupal.

Code

function wysiwyg_profile_overview() {
  include_once './includes/install.inc';
  $form = array();

  // Check which wysiwyg editors are installed.
  $editors = wysiwyg_get_all_editors();
  $count = count($editors);
  $status = array();
  $options = array(
    '' => t('No editor'),
  );
  foreach ($editors as $editor => $properties) {
    $status[$editor] = array(
      'severity' => isset($properties['error']) ? REQUIREMENT_ERROR : ($properties['installed'] ? REQUIREMENT_OK : REQUIREMENT_INFO),
      'title' => t('<a href="!vendor-url">@editor</a> (<a href="!download-url">Download</a>)', array(
        '!vendor-url' => $properties['vendor url'],
        '@editor' => $properties['title'],
        '!download-url' => $properties['download url'],
      )),
      'value' => isset($properties['installed version']) ? $properties['installed version'] : t('Not installed.'),
      'description' => isset($properties['error']) ? $properties['error'] : ($properties['installed'] ? '' : t('Extract the archive and copy its contents into a new folder in the following location:<br /><code>@editor-path</code>', array(
        '@editor-path' => $properties['editor path'],
      ))),
    );
    if ($properties['installed']) {
      $options[$editor] = $properties['title'] . (isset($properties['installed version']) ? ' ' . $properties['installed version'] : '');
    }
    else {
      $count--;
    }
  }
  $form['status'] = array(
    '#type' => 'fieldset',
    '#title' => t('Installation instructions'),
    '#collapsible' => TRUE,
    '#collapsed' => $count,
    '#description' => !$count ? t('There are no editor libraries installed currently. The following list contains a list of currently supported editors:') : '',
    '#weight' => 10,
  );
  $form['status']['report'] = array(
    '#type' => 'markup',
    '#value' => theme('status_report', $status),
  );
  if (!$count) {
    return $form;
  }
  $formats = filter_formats();
  $profiles = wysiwyg_load_profile();
  $form['formats']['#tree'] = TRUE;
  foreach ($formats as $id => $format) {
    $form['formats'][$id]['name'] = array(
      '#value' => check_plain($format->name),
    );
    $form['formats'][$id]['editor'] = array(
      '#type' => 'select',
      '#default_value' => isset($profiles[$id]) ? $profiles[$id]->editor : '',
      '#options' => $options,
      '#id' => "edit-editor-{$id}",
      '#disabled' => isset($profiles[$id]) ? (bool) $profiles[$id]->editor : FALSE,
    );
    if (isset($profiles[$id]) && !empty($profiles[$id]->editor)) {
      $form['formats'][$id]['edit'] = array(
        '#value' => l(t('Edit'), 'admin/settings/wysiwyg/profile/edit/' . $profiles[$id]->format),
      );
      $form['formats'][$id]['remove'] = array(
        '#value' => l(t('Remove'), 'admin/settings/wysiwyg/profile/delete/' . $profiles[$id]->format),
      );
    }
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}