You are here

function bueditor_plus_admin in BUEditor Plus 7

Same name and namespace in other branches
  1. 7.2 bueditor_plus.admin.inc \bueditor_plus_admin()

Main administration page. Overrides the default BUEditor admin page. We actually grab the bueditor_admin build array and replace the form with our own to represent the new profiles system. The format has been mimicked from the original bueditor_admin() form for the purposes of usability.

1 string reference to 'bueditor_plus_admin'
bueditor_plus_menu_alter in ./bueditor_plus.module
Implements hook_menu_alter().

File

./bueditor_plus.admin.inc, line 15
Provides the administration interface for bueditor_plus.

Code

function bueditor_plus_admin() {

  // We are going to load the original page from bueditor_admin and then
  // unset the form in the build array.
  module_load_include('inc', 'bueditor', 'admin/bueditor.admin');
  $output = bueditor_admin();
  unset($output['form']);

  // Add in our profiles table.
  $path = 'admin/config/content/bueditor/profile';
  $profiles = bueditor_plus_profiles();
  $header = array(
    t('Profile name'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $rows = array();

  // We don't need our special "global" profile to appear in the table,
  // so we go ahead and unset it.
  unset($profiles['global']);
  foreach ($profiles as $pid => $profile) {
    $profile->name = check_plain($profile->name);
    $name = $profile->global ? $profile->name . ' <em>(' . t('Global') . ')</em>' : $profile->name;
    $rows[] = array(
      $name,
      l(t('Edit'), $path . '/edit/' . $pid) . ' | ' . l(t('Delete'), $path . '/delete/' . $pid),
    );
  }

  // Even though we add a local action link, we keep the Add new Profile
  // link in the table so that it copies the same usability as the bueditor
  // editor's table from bueditor_admin().
  $rows[] = array(
    '',
    l(t('Add new profile'), $path . '/new'),
  );
  $output['profile_title'] = array(
    '#markup' => '<h2 class="title">' . t('Available profiles') . '</h2>',
  );
  $output['profile_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#attributes' => array(
      'id' => 'available-profiles-list',
    ),
  );
  return $output;
}