Closed (fixed)
Project:
Wysiwyg
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
20 Nov 2012 at 19:31 UTC
Updated:
20 Nov 2012 at 21:01 UTC
I'm trying to create a WYSIWYG profile (TinyMCE) in code for an installation profile. I'll list my code below, but here is the short story.
If I use the code as is, I get an error when I try to edit the profile.
If I hack the settings part of the array down, I get the same error.
If I hack the settings array down to where it is empty, I get the same error.
If I set settings to NULL, I can edit the profile.
I haven't found any example code yet and would really like to see some.
Please, anyone have an idea what is going on? I've looked in the database at this entry and at an entry I created by hand and I see no difference in what winds up in the DB. Help.
$wysiwyg_settings_tinymce = array (
'format' => 'htmlpurifier',
'editor' => 'tinymce',
'settings' =>
array (
'default' => 1,
'user_choose' => 0,
'show_toggle' => 1,
'theme' => 'advanced',
'language' => 'en',
'buttons' =>
array (
'default' =>
array (
'bold' => 1,
'italic' => 1,
'underline' => 1,
'strikethrough' => 1,
'justifyleft' => 1,
'justifycenter' => 1,
'justifyright' => 1,
'justifyfull' => 1,
'bullist' => 1,
'numlist' => 1,
'outdent' => 1,
'indent' => 1,
'undo' => 1,
'redo' => 1,
'link' => 1,
'unlink' => 1,
'anchor' => 1,
'image' => 1,
'code' => 1,
'hr' => 1,
'cut' => 1,
'copy' => 1,
'paste' => 1,
'removeformat' => 1,
'charmap' => 1,
),
'advimage' =>
array (
'advimage' => 1,
),
'advlink' =>
array (
'advlink' => 1,
),
'font' =>
array (
'formatselect' => 1,
'styleselect' => 1,
),
'paste' =>
array (
'pastetext' => 1,
'pasteword' => 1,
),
'table' =>
array (
'tablecontrols' => 1,
),
'media' =>
array (
'media' => 1,
),
'imce' =>
array (
'imce' => 1,
),
'video_filter' =>
array (
'video_filter' => 1,
),
), // end of buttons
'toolbar_loc' => 'top',
'toolbar_align' => 'left',
'path_loc' => 'bottom',
'resizing' => 1,
'verify_html' => 1,
'preformatted' => 0,
'convert_fonts_to_spans' => 1,
'remove_linebreaks' => 1,
'apply_source_formatting' => 0,
'paste_auto_cleanup_on_paste' => 0,
'block_formats' => 'p,h1,h2',
'css_setting' => 'theme',
'css_path' => '',
'css_classes' => '',
)
);
$wysiwyg_settings_tinymce['settings'] = serialize($wysiwyg_settings_tinymce['settings']);
drupal_write_record('wysiwyg', $wysiwyg_settings_tinymce);
| Comment | File | Size | Author |
|---|---|---|---|
| profile-error.png | 11.02 KB | dpearcefl |
Comments
Comment #1
dpearcefl commentedHere is the cause of the error message: In wysiwyg.module and wysiwyg_profile_form(), $profile is assumed to be array. When I try to create a profile, $profile is unserialized!
Why isn't the profile data being unserialized?
Comment #2
dpearcefl commentedThe problem turned out to be a really obscure issue with drupal_write_record() and db_query() not handling curly braces in DB fields. I'm sure there must be more to this, but I changed the last line to:
It works now.