Version 2.3 added support for storing plugin version and some settings in profiles.
Problem
When editor is configured and exported to features, the export captures all changes correctly (plugin version etc). But when reverting from this exported code in another environment, the changes are not applied and profile UI reports that plugin version is not what is expected in profile Re-export of the config from this environment produces code with NULL values:
Originally exported values
// Exported profile: filtered_html
$profiles['filtered_html'] = array(
'format' => 'filtered_html',
'editor' => 'ckeditor',
// SNIP
),
'preferences' => array(
'default' => 1,
'user_choose' => 0,
'show_toggle' => 1,
'add_to_summaries' => 0,
'version' => '4.6.1.580bcaf',
),
'name' => 'formatfiltered_html',
);
Values after feature revert->feature update on another environment
// Exported profile: filtered_html
$profiles['filtered_html'] = array(
'format' => 'filtered_html',
'editor' => 'ckeditor',
// SNIP
),
'preferences' => array(
'add_to_summaries' => NULL,
'default' => NULL,
'show_toggle' => NULL,
'user_choose' => NULL,
'version' => NULL,
),
'name' => 'formatfiltered_html',
);
How to reproduce
1. Install this module and CKeditor on clean environment.
2. Go to WYSIWYG profiles UI and check that plugin version is discovered. (all good)
3. Edit a profile and enable some checkboxes ("Enabled by default" etc).
4. Create a feature and export this profile. The exported code will contain correct values. (all good)
5. Go to new environment and revert exported feature.
6. Go to WYSIWYG profiles page and note that there is a warning "CKEditor (Expected version: but found 4.6.1.580bcaf.)" (bad, the version of the plugin has not been imported during feature revert).
7. Edit the profile and note that previously checked checkboxes ("Enabled by default" etc) are not selected. (bad)
Also, Features UI shows the following error:
Notice: Undefined index: add_to_summaries in wysiwyg_features_rebuild() (line 85 of /var/beetbox/docroot/sites/all/modules/contrib/wysiwyg/wysiwyg.features.inc).
Notice: Undefined index: default in wysiwyg_features_rebuild() (line 86 of /var/beetbox/docroot/sites/all/modules/contrib/wysiwyg/wysiwyg.features.inc).
Notice: Undefined index: show_toggle in wysiwyg_features_rebuild() (line 87 of /var/beetbox/docroot/sites/all/modules/contrib/wysiwyg/wysiwyg.features.inc).
Notice: Undefined index: user_choose in wysiwyg_features_rebuild() (line 88 of /var/beetbox/docroot/sites/all/modules/contrib/wysiwyg/wysiwyg.features.inc).
Notice: Trying to get property of non-object in wysiwyg_features_rebuild() (line 96 of /var/beetbox/docroot/sites/all/modules/contrib/wysiwyg/wysiwyg.features.inc).
Notice: Undefined index: add_to_summaries in wysiwyg_features_rebuild() (line 85 of /var/beetbox/docroot/sites/all/modules/contrib/wysiwyg/wysiwyg.features.inc).
Notice: Undefined index: default in wysiwyg_features_rebuild() (line 86 of /var/beetbox/docroot/sites/all/modules/contrib/wysiwyg/wysiwyg.features.inc).
Notice: Undefined index: show_toggle in wysiwyg_features_rebuild() (line 87 of /var/beetbox/docroot/sites/all/modules/contrib/wysiwyg/wysiwyg.features.inc).
Notice: Undefined index: user_choose in wysiwyg_features_rebuild() (line 88 of /var/beetbox/docroot/sites/all/modules/contrib/wysiwyg/wysiwyg.features.inc).
Notice: Trying to get property of non-object in wysiwyg_features_rebuild() (line 96 of /var/beetbox/docroot/sites/all/modules/contrib/wysiwyg/wysiwyg.features.inc).
Comment | File | Size | Author |
---|---|---|---|
#12 | profile-preferences-not-reverted-from-features-2841479-12.patch | 1.81 KB | Sardis |
#7 | profile-preferences-not-reverted-from-features-2841479-2.patch | 1.81 KB | alex.skrypnyk |
Comments
Comment #2
alex.skrypnykComment #3
alex.skrypnykComment #4
alex.skrypnykComment #5
alex.skrypnykComment #6
alex.skrypnykComment #7
alex.skrypnykI have reviewed the code in
wysiwyg_features_rebuild()
and it had some issues that were related to not storing preferences into the correct location under settings.Also, there is an issue with retrieving editor information from function
wysiwyg_get_editor()
as object, but the function returns an array.Another issue was related to spelling of
$preferences
variable.All these issues are fixed in attached path. It was tested with multiple feature updates and reverts.
Comment #8
alex.skrypnykComment #10
TwoDExcellent, works just like you said, stupid mistake on my part for not catching that earlier.
Comment #12
Sardis CreditAttribution: Sardis at Drupalway, Drupal Ukraine Community for Drupal Ukraine Community, Drupalway commentedI've noticed small CS errors, so i dare to fix them.
However, nice work, @alex.designworks!
Comment #13
TwoD@Sardis,
Thanks for the whitespace cleanups, but please note that the original patch has already been committed so your patch will not apply against the current branch HEAD.
I also think this would be more suitable as a follow-up CS-issue referencing this one for when the problem got introduced. Then we can track status of just the cleanup changes vs mixing it with the functionality change made here. (And I could actually credit you for providing the cleanup patch.)
Comment #14
Sardis CreditAttribution: Sardis at Drupalway, Drupal Ukraine Community for Drupal Ukraine Community, Drupalway commentedActually, this excessive whitespace
$settings = &$profile['preferences'];
has been fixed already in #2851200: Update verified version range issue, along with proper version exporting.So i beg your pardon.