To reproduce: 'Configure' the Filtered HTML format, set the name to Full HTML.
Relevant error: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Full HTML'' for key 'name': UPDATE {filter_format} SET name=:db_update_placeholder_0, cache=:db_update_placeholder_1 WHERE (format = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => Another Format [:db_update_placeholder_1] => 1 [:db_condition_placeholder_0] => 5 ) in drupal_write_record() (line 6201 of includes/common.inc).
Reason: filter_admin_format_form_validate() only validates new formats, not changes to existing ones.
Comment | File | Size | Author |
---|---|---|---|
#1 | drupal-filter-899752-1.patch | 1.41 KB | tim.plunkett |
Comments
Comment #1
tim.plunkettThis 'works'. I have a feeling its not the way to do it, would love to learn the right way.
Comment #3
tim.plunkettWell duh, should've seen that coming. Leaving as needs work, maybe I'll have more time for this later.
Comment #4
sunTo do this, you need to add an internal (#type = 'value') form element called "old_name" to the form, so as to be able to recognize whether the text format name actually changed.
Comment #5
sunNot major, just a bug.
Comment #6
sunI was wrong in #4. The "old name", if any, can be read from $form['name']['#default_value']