function tinymce_admin in TinyMCE 5.2
Same name and namespace in other branches
- 5 tinymce.module \tinymce_admin()
- 6.2 tinymce.admin.inc \tinymce_admin()
- 6 tinymce.admin.inc \tinymce_admin()
Controller for tinymce administrative settings.
1 string reference to 'tinymce_admin'
- tinymce_menu in ./
tinymce.module - Implementation of hook_menu().
File
- ./
tinymce.module, line 420 - Integrate the TinyMCE editor (http://tinymce.moxiecode.com/) into Drupal.
Code
function tinymce_admin($arg = NULL) {
$edit = $_POST;
$op = $_POST['op'];
$op = $arg && !$op ? $arg : $op;
switch ($op) {
case 'add':
$breadcrumb[] = array(
'path' => 'admin',
'title' => t('administer'),
);
$breadcrumb[] = array(
'path' => 'admin/settings/tinymce',
'title' => t('tinymce'),
);
$breadcrumb[] = array(
'path' => 'admin/settings/tinymce/add',
'title' => t('Add new TinyMCE profile'),
);
menu_set_location($breadcrumb);
$output = tinymce_profile_form($edit);
break;
case 'edit':
drupal_set_title(t('Edit tinymce profile'));
$output = tinymce_profile_form(tinymce_profile_load(urldecode(arg(4))));
break;
case 'delete':
tinymce_profile_delete(urldecode(arg(4)));
drupal_set_message(t('Deleted profile'));
drupal_goto('admin/settings/tinymce');
break;
case t('Create profile'):
case t('Update profile'):
if (tinymce_profile_validate($edit)) {
tinymce_profile_save($edit);
$edit['old_name'] ? drupal_set_message(t('Your TinyMCE profile has been updated.')) : drupal_set_message(t('Your TinyMCE profile has been created.'));
drupal_goto('admin/settings/tinymce');
}
else {
$output = tinymce_profile_form($edit);
}
break;
default:
drupal_set_title(t('TinyMCE settings'));
//Check if TinyMCE is installed.
$tinymce_loc = drupal_get_path('module', 'tinymce') . '/tinymce/';
if (!is_dir($tinymce_loc)) {
drupal_set_message(t('Could not find the TinyMCE engine installed at <strong>!tinymce-directory</strong>. Please <a href="http://tinymce.moxiecode.com/">download TinyMCE</a>, uncompress it and copy the folder into !tinymce-path.', array(
'!tinymce-path' => drupal_get_path('module', 'tinymce'),
'!tinymce-directory' => $tinymce_loc,
)), 'error');
}
$output = tinymce_profile_overview();
}
return $output;
}