You are here

function ckeditor_htmlbuttons_overview in CKEditor HTML Buttons (for WYSIWYG and CKEditor) 7

CKEditor HTML Buttons overview page - view buttons and edit them.

1 string reference to 'ckeditor_htmlbuttons_overview'
ckeditor_htmlbuttons_menu in ./ckeditor_htmlbuttons.module
Implements hook_menu().

File

./ckeditor_htmlbuttons.admin.inc, line 11
Administrative page callbacks for the CKEditor HTML Buttons module.

Code

function ckeditor_htmlbuttons_overview() {
  $rows = array();
  $help = '';

  // Load the buttons and display them on the admin form.
  $buttons = ckeditor_htmlbutton_load_all();
  foreach ($buttons as $button) {
    $row = array();
    $row[] = !empty($button['icon']) ? theme('image', array(
      'path' => $button['icon'],
    )) : '';
    $row[] = $button['title'];
    $row[] = l(t('edit'), 'admin/config/content/ckeditor-htmlbuttons/edit/' . $button['name']);
    $row[] = l(t('delete'), "admin/config/content/ckeditor-htmlbuttons/delete/" . $button['name']);
    $rows[] = $row;
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No buttons available.'),
        'colspan' => 4,
      ),
    );
  }
  $rows[] = array(
    array(
      'data' => l(t('Create a new button'), 'admin/config/content/ckeditor-htmlbuttons/add'),
      'colspan' => 4,
    ),
  );
  $header = array(
    array(
      'data' => '',
      'width' => '1',
    ),
    array(
      'data' => t('Name'),
      'width' => '70%',
    ),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  if (module_exists('wysiwyg') || module_exists('ckeditor')) {
    if (module_exists('wysiwyg')) {
      $help_variables = array(
        '!profiles' => l(t('WYSIWYG Profile'), 'admin/config/content/wysiwyg'),
      );
    }
    else {
      $help_variables = array(
        '!profiles' => l(t('CKEditor'), 'admin/config/content/ckeditor'),
      );
    }
    $help = t('Here you can create custom html toolbar buttons. The buttons will need to be enabled from the !profiles settings.', $help_variables) . '</p>';
  }
  else {
    drupal_set_message(t('You need to install either !ckeditor or !wysiwyg module before the buttons you define here are possible to use.', array(
      '!ckeditor' => l(t('CKEditor'), 'https://www.drupal.org/project/ckeditor'),
      '!wysiwyg' => l(t('Wysiwyg'), 'https://www.drupal.org/project/wysiwyg'),
    )), 'error');
  }
  return '<p>' . $help . '</p>' . theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'id' => 'ckeditor_htmlbuttons',
  ));
}