Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Book nodes have metadata indicating their place in the book tree returned with them, but it is not possible to specify this metadata during node creation because the metadata setter callback is not defined. This patch adds the setters so book nodes can be created with the parent and book ID.
Comment | File | Size | Author |
---|---|---|---|
#3 | entity-2405011-3-book-create.patch | 2 KB | akalsey |
entity-book-create.patch | 1.52 KB | akalsey | |
Comments
Comment #2
akalsey CreditAttribution: akalsey commentedLooks like the test is the problem. The hook_entity_property_info_alter() that already exists in the module defines the type for book_ancestors as 'list<node>', but the tests don't handle this type. So when the setter runs, the test fails when trying to create that type.
I'll see about fixing the test.
Comment #3
akalsey CreditAttribution: akalsey commentedlist<node> seems to be just a list of ids, so I've added a random number as the type. Tests pass, doesn't break any other tests, but this doesn't seem the right way to do it. Any better ideas?
Comment #4
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 4 year old patch in #3 applied cleanly to the latest entity 7.x-1.x-dev and (if still relevant) needs review.