Hi there. Great module!
I'm currently using a simple 'book page' content type to be the child of 3 different parent content types.
I really only want those book pages to be created when a user chooses to 'add a child page'.
So if there was some new option to prevent a particular content type from being created unless it is being added to a book that'd be fantastic.
Alternatively I suppose if you have any ideas as to how I could deny access to the create content page of a particular content type unless the url contains the '?parent=x' bit that should get me by, just about.
Thanks. And again, great module!
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | book_made_simple.module.txt | 20.47 KB | MarcElbichon |
| #3 | book_made_simple.module.txt | 19.96 KB | MarcElbichon |
Comments
Comment #1
MarcElbichon commentedThere's an option in the content-type settings called "Forbid creation of book main page" that would do the trick.
Comment #2
Shadlington commentedI'm aware of that setting (and am using it) but it doesn't solve my problem completely.
People can still create content of the type that I have designated as the one I want to use for book 'pages' independently of a book.
I want to restrict access to the create content page of this particular content type unless they are specifically adding to a book.
Perhaps an example will help me explain...
I have a content type 'bookpage' and a content type 'book'.
'bookpage' has 'forbid creation of book main page', has no possible child content types and has only 'book' as a parent type.
'book' has 'auto create main page', has 'bookpage' as its only child type and has no possible parent types.
Additionally, I have removed 'bookpage' from the 'create content' menu, so the only link in the UI to the creation of a 'bookpage' is through the 'add a book page' link on the 'book' content type.
This works, but if someone navigates to /node/add/bookpage they can create an orphaned 'bookpage'. For me, an ideal solution would restrict access unless the 'bookpage' was being added to a valid book (i.e. the presence of '?parent=x' in the url).
I hope that clarifies what I meant.
Hopefully this isn't too specific a use case. It only makes sense if you have a separate content type to be used as a page and you do not want that type being used for anything else.
Comment #3
MarcElbichon commentedCan you try this version (including limit book depth) ?
Rename attached file to book_made_simple.module
Comment #4
Shadlington commentedThat does the trick!
That said, I did find a way to break it. Sort of.
It certainly does what I asked for, but if I stick something that doesn't actually correspond to a book in 'parent=' then it still lets you create the node.
Plus any nodes created like this don't allow you to edit them (you get "This content-type cannot be created outside a book. Creation cancelled" when you try to).
Comment #5
MarcElbichon commentedCan you try this version ?
Limit depth can be customized in BookMadeSimple settings.
Comment #6
Shadlington commentedOh nice! That works. Forbidden content types are being limited properly - I can't trick it into letting me create one outside a book.
And the depth limit setting is working great too.
EDIT: Ah, I thought I'd test it a bit more thoroughly and I think I found another problem. You can use the outline and reorder tabs to bypass both of these rules, by moving a child to be underneath another child after the initial creation.
Comment #7
MarcElbichon commentedWill add this to next release.
Comment #8
scottrigbyComment #9
gurtner commentedI'm having the opposite issue.. Using Drupal 7 and I'm trying to allow certain content types to be allowed to be added to books while preventing certain other content types from being allowed to be added to books. And while the interface gives me the options for allowing or not, the content types that should be prevented from being added to books are still being allowed to be added to books... Anyone got a fix for that?
Comment #10
MarcElbichon commentedCan't you do this by content-type settings ?