1) Rename {filter} to {filter_format_filter} to make clear we are storing filter data that references a certain text format (in {filter_format}).
2) Remove the serial {filter}.id column - our unique key is 'format' + 'name'. (Filters can only exist once per format)
3) Add a {filter}.status column, so we can query only enabled filters in a format.
4) Add a {filter}.settings column to store the filter's settings in the database (the filter configuration is different for each format).
Also, the {filter}.module column should stay. If a module is uninstalled, filter module's implementation of hook_modules_uninstalled() should remove obsolete data.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | drupal.filter-settings.22.patch | 55.46 KB | sun |
| #20 | drupal.filter-settings.20.patch | 49.93 KB | sun |
| #19 | drupal.filter-settings.19.patch | 49.26 KB | dropcube |
| #18 | drupal.filter-settings.18.patch | 48.32 KB | sun |
| #16 | drupal.filter-settings.16.patch | 47.07 KB | sun |
Comments
Comment #1
sunsubscribing
Comment #2
dropcube commentedAttached a first patch. Still requires work in the update path and to fix some tests.
Summary:
- Updated filter.module schema as proposed above.
- Filter configuration settings are now stored in the database, and not in system variables (TODO: update path for variables)
- Install profile uses the API to create the formats enable filters/roles, and save configuration.
Comment #3
dropcube commentedComment #5
sunRe-rolled against HEAD.
Comment #7
sunReverted some not strictly necessary changes.
Comment #9
sunQuite. A. Patch.
Comment #11
dropcube commentedUpdated patch:
- Added documentation to filter.api.php about the parameters passed to each callback function and how them should access the filter settings.
- Used text format api to install format in php.module, this fixed the issue with PHP module tests.
- Fixed other minor issues reported by tests.
TODO: there is still a couple of field test failing.
Comment #13
dropcube commentedThe attached patch reverts the changes in system.install, seems that it was causing the test fails. It's better to deal with it in other issue: #556838: Install profiles should install the text formats they require
Comment #14
sunThanks for removing that part. Clearly belongs into the other issue.
In this patch:
- Removed the redirection to the format overview page after saving an existing format. Total UX nightmare.
- Introduced 'default settings' property for hook_filter_info() items. Default settings are automatically merged into $filter->settings. This is important, because filters in newly created text formats do not have any settings yet. Thanks to this, 'prepare', 'process', and 'tips' callbacks no longer have to duplicate the default settings all over the place. Default settings are defined once and all callbacks can simply rely on them. Furthermore, filter implementations can introduce additional settings at any time, and those need default values, too. Lastly, we can remove the hard-coded default settings from system.install that would have been added in a previous patch.
- Changed check_markup() to pass along the (new) $cache argument to 'prepare' and 'process' callbacks, so they know whether the (also passed) $cache_id is actually used. This was somehow forgotten when the $cache argument was added to check_markup().
- Updated filter.api.php accordingly.
Comment #16
sunThis one should pass. Includes some further, nice clean-ups for the core filter tests.
Actually I think this is RTBC. I hope that dropcube can give it another review.
Comment #17
sunBetter title.
Comment #18
sunFixed the upgrade path.
Summary:
Problem
Details
Solution
Comment #19
dropcube commentedI think we are ready to go.
Polishing a little more the documentation:
- Fixed typo in documentation.
- Added documentation to filter.api.php about all the parameters passed to 'settings callback'.
- Added example of how a module can alter default settings provided by a filter using hook_filter_info_alter().
- Fixed documentation around 'settings callback'.
4 days to code freeze. Better review yourself.
Comment #20
sunJust fixed some typos in the adjusted documentation.
I don't think that anyone can have any further objections to this, especially since we managed to get a flood of patches as preparation for this "final" master patch already in. Simply put, this is the conclusion and last API change of FilterSystemRevamp.
Additionally, it is a blocker for #558666: UX/security: Revamp text format/filter configuration (which is probably one of the most confusing UIs in Drupal).
Comment #21
dropcube commentedReviewed the last patch, and confirm it's RTBC.
Comment #22
sun- Fixed PHPDoc of module update function.
- Added PHPDoc for filter_format_load().
- Added CHANGELOG.txt entry.
- Added some more verbose information about the flow of the callback definitions in the API docs.
Hope that helps. :)
Comment #23
dries commentedGreat patch. Committed to CVS HEAD.
Comment #24
sunMarking as needs work for upgrade docs.
Comment #25
catch#653068: Update documentation is incomplete
Comment #26
jhodgdonchanging tagging scheme
Comment #27
jhodgdonSummary of this issue in comment #18 above, and committed patch in #22... let's see. I'm trying to figure out what was a d6 to d7 change from #18 and the patch.
But see
http://drupal.org/update/modules/6/7#hook_filter_info
It looks like all of this was a change added to the existing change -- hook_filter() in d6 changed to hook_filter_info(), and this just added to it a bit. That change is already documented in the d6/7 update guide.
Two columns were also added to the {filter} table, but that won't break any d6 modules.
So it looks like the only thing we need to add to the 6/7 module update guide is the part about filter settings being stored in the db table vs. in a variable. But looking at the update function in the patch, it only looks like it's updating the HTML and URL filters, not any filters that other modules may have defined, so I don't see that this is going to affect contrib/custom modules. I'm inclined to say it doesn't need update doc after all.
Feel free to reopen and explain what needs to be update documented...