You are here

function bueditor_eop_copy in BUEditor 7

Same name and namespace in other branches
  1. 6.2 admin/bueditor.admin.inc \bueditor_eop_copy()

Editor copy operation.

1 call to bueditor_eop_copy()
bueditor_eop in admin/bueditor.admin.inc
Prepare and execute if there is any valid editor operation that doesn't require form submission.

File

admin/bueditor.admin.inc, line 822

Code

function bueditor_eop_copy($editor, $name) {
  $editor = clone $editor;
  $buttons = bueditor_buttons($editor->eid);
  $editor->eid = NULL;
  $editor->name = $name ? $name : 'Copy of ' . $editor->name;
  array_walk($buttons, function (&$button) {
    $button->bid = NULL;
  });
  if ($editor = bueditor_write_editor($editor, $buttons)) {
    bueditor_message_added($editor->name);
  }
  return $editor;
}