You are here

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

CKEditor HTML Buttons database save function.

1 call to ckeditor_htmlbutton_save_button()
ckeditor_htmlbuttons_button_form_submit in ./ckeditor_htmlbuttons.admin.inc
CKEditor HTML Buttons form submit - delete and save handlers.

File

./ckeditor_htmlbuttons.module, line 157
Basic module file for CKEditor HTML Buttons.

Code

function ckeditor_htmlbutton_save_button($button) {
  $new_button = array(
    'name' => $button['name'],
    'title' => $button['title'],
    'fid' => $button['fid'],
    // \r\n fixes wrapping feature of HTML Buttons plugin.
    // There's a question posted about this here:
    // http://ckeditor.com/addon/htmlbuttons?page=1
    'html' => trim($button['html']) . "\r\n",
  );
  $existing = ckeditor_htmlbuttons_name_exists($button['name']);

  // Save to database.
  return drupal_write_record('ckeditor_htmlbuttons', $new_button, $existing ? 'name' : array());
}