Quantcast
Viewing all articles
Browse latest Browse all 293238

Book allowed_types settings repetitive and in under certain conditions can change unexpectedly

In #1928082: Make usage of book.settings:allowed_types consistent (http://drupal.org/node/1928082#comment-7128904) @sun points out that the duplicate key/value in book.settings:allowed_types kind of sucks. That patch made the following change.

allowed_types:
-  - book
+  book: book

In trying to resolve this issue I realised we actually have a much more important issue. book_node_type_update() keeps book.settings in sync with node type changes. At the moment if you have two content types with machine names book and page as allowed types and then you change the book machine name to album the book_node_type_update() function will update book.settings:allowed_types to:
  page: page
  album: album

If you were then to go to admin/content/book/settings and press the save button without making any changes to the form book.settings:allowed_types will be updated to:
  album: album
  page: page

This means you will end up with unexpected config changes which is a bad thing(tm).

Viewing all articles
Browse latest Browse all 293238

Trending Articles