Use case: (see also https://drupal.org/node/1216224#comment-7477170)
Create a filter format
Create a ckeditor profile (or modify an existing one) that is assigned to the above format
Export both of these things to a feature
Enable the feature on a clean install

The ckeditor profile is imported, but it no longer has the assignment to it's input format. That is because if the format does not exist when the ckeditor profile is created, the ckeditor_input_format row is removed from the db. If the format does exist, it's fine.

Current workaround is to maintain two features - one with the input format, the other with the ckeditor profile - and use module dependencies to ensure the correct order.

Files: 
CommentFileSizeAuthor
#6 ckeditor-ckeditor_features_format-2043365-6.patch1.64 KBDanny_Joris
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#2 ckeditor-ckeditor_features_format-2043365-2.patch1.36 KBErik Erskine
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Comments

Title:ckeditor profile exported as feature with filter format does ckeditor profile exported as feature with filter format does not import properly

StatusFileSize
new1.36 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

In ckeditor_profile_features_revert(), we delete from ckeditor_input_format if the filter doesn't exist:

<?php
if (isset($input_formats[$input_format])) {
  if (!
db_query("SELECT name FROM {ckeditor_input_format} WHERE format = :format AND name = :name", array(':name' => $name, ':format' => $input_format))->fetchField()) {
   
db_query("INSERT INTO {ckeditor_input_format} (name, format) VALUES(:name, :format)", array(':name' => $name, ':format' => $input_format));
  }
}
else {
 
// Make sure they don't have access
 
db_query("DELETE FROM {ckeditor_input_format} WHERE format = :format AND name = :name", array(':name' => $name, ':format' => $input_format));
}
?>

Is this necessary? Do the extra rows in the ckeditor_input_format do any harm? On a fresh install of ckeditor the Advanced and Full profiles are assigned to filtered_html and full_html respectively, even if these formats don't exist (eg with a minimal install).

I would suggest taking the above check (and delete) out and have attached a patch to do that.

Thoughts welcome - does removing this have any ill effects?

Status:Active» Needs review

Erik,

I had the same problem, and removing the DELETE fixed it. Thnx for the tip.

Kieran

Patch #2 works great, but I need to add an additional (imo) hack to my feature for a smooth install. I need to remove the default profiles fully before the ones in the feature can applied properly. If there's a better solution I'd love to know.

In my case my ckeditor profiles in features needed a manual revert after a fresh site-install (my feature is part of an install profile), plus after that the 'full' ckeditor profile would still be misconfigured as to work with the 'full html' text formatter. In my feature it wasn't set to anything, so I'd manually have to unset that.

<?php
/**
* Implements hook_enable().
*
* Deletes ckeditor's default profiles.
*/
function MY_FEATURE_enable() {
  if (
module_exists('ckeditor')) {
   
module_load_include('inc', 'ckeditor', 'includes/ckeditor.admin');
   
ckeditor_profile_delete('Full');
   
ckeditor_profile_delete('Advanced');
  }
}
?>

StatusFileSize
new1.64 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Scrap the hack in #5 - I updated Erik's patch (#2), so that when it encounters a ckeditor profile with no input formats assigned (empty array), it removes that profile from the 'ckeditor_input_format' table. Please review.

I tested patch ckeditor-ckeditor_features_format-2043365-6.patch and it solves problem. Thanks.

Issue summary:View changes
Issue tags:+export

Status:Needs review» Reviewed & tested by the community

The patch in #6 works for me. With it applied, I can have a CKEditor profile and Text Format in the same feature, and when enabling it, the CKEditor profile is connected to the correct text format. Thanks!

  • Commit 0508f82 on 7.x-1.x authored by Danny_Joris, committed by wwalc: Issue #2043365 by Erik Erskine, Danny_Joris: CKEditor profile exported...

Status:Reviewed & tested by the community» Fixed

Committed, thanks!