Hello
The sample provided xbbcode filter should be deletable.
This means, it should be inserted into the drupal database with hook_install() and removed with hook_uninstall(), and not be present all the time with hook_filter_info().
The reasoning for this is that a filter, like most objects in drupal, should be inserted during install, but never forced by modules, so that users can delete these, replace them as they see fit, or export to features.
You can disable the current filter but you can never delete it or rename the id, as long as this hook remains.
Comments
Comment #2
lpalgarvio commentedThis is one of the kind of errors you can get after exporting your feature with BBcode filter and clearing caches:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'BBcode' for key 'name': INSERT INTO {filter_format} (format, name, cache, status, weight) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => bbcode [:db_insert_placeholder_1] => BBcode [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => -9 ) in filter_format_save() (line 225 of /sites/all/modules/filter/filter.module).Comment #3
cburschkaI'm sorry, but I think you may be misunderstanding the Filter API, and possibly confusing filters with text formats.
In object terms, filters aren't entities, they're plugins - and they literally can't be created by hook_install() or provided to the filter system through any other means than
hook_filter_info(). There is no way to edit or delete them; they are simply discovered through the hook.The database error you are seeing is a duplicate key in the
{filter_format}table that stores the text format. The text format is an entity that can be created and edited (but never fully deleted, because Drupal permanently reserves the name). The BBcode text format is created byhook_enable(), and disabled withhook_disable().What are you trying to do?
Comment #4
cburschka