Hi everyone,
Inspired after reading http://api.drupal.org/api/4.7/file/developer/examples/node_example.module and http://drupal.org/node/40684, I tried to duplicate the book module by copying the module file and replacing all the words 'book' with 'blah', and by creating a new 'blah' table as well (by exporting a clean table of 'book'). Unfortunately, I did not just run into the styling issues that http://drupal.org/node/2814 ran into, but there seem to be a lot of clash between the book and blah modules. At the bottom of both my blah and book pages I see two instances of 'add child page' and 'printer friendly version'. One links to adding a child page in the blah module ../node/add/blah/parent.. which would be correct if the page I am viewing is a blah page, while the other links to adding a child page in the book module ../node/add/book/parent.. which would be wrong since I am viewing a blah page. Same applies for book pages.
If I turn off either module then the double linking disappears, so it definitely seems to be an overlap in functions of these two modules. Since there were two 'add child page' links I had a look at the code (I don't know php) and it seems that it would probably be a problem with the 'if' conditional? I think both modules are saying 'yes' to the 'if' conditional regardless of whether you are looking at a blah or a book page.
function book_link($type, $node = 0, $main = 0) {
$links = array();
if ($type == 'node' && isset($node->parent)) {
if (!$main) {
if (book_access('create', $node)) {
$links[] = l(t('add child page'), "node/add/book/parent/$node->nid");Any ideas how to resolve this? This problem would probably be present beyond the simple problem of links right? There would also be some functionality problems right?
Also let me clarify that I need to duplicate the book module specifically for it's functionality beyond the story or page module (its automatically generated navigation system etc) so that is why I duplicated it.
Any help would be much appreciated!
JH
Comments
this may be a stupid question...
Will your new module be doing the exact same thing as the book module? If so, then are you just wanting the book module not to be called "book"? Or are you wanting two separate content types "book" and "blah" to used simultaneously.
The reason that I ask is because this seems to be an issue that could be solved other (easier) ways.
As for the duplicate links: yes, the problem is with the
if()statements. perhaps it would be better to read like so:that should fix the problem.
- Corey
Heh, good point, sorry for
Heh, good point, sorry for not making it clear, I want TWO nodes with book-like properties to be used SIMULTANEOUSLY, for reasons like OG permissions (one type to be excluded from OG audience control)
Sorry, I not familiar at all with the book module code so I'm wondering if there are any OTHER places where such functionality would overlap (and hence necessitating me to go in and change the code as you suggested above)?
In the meantime, I'll try it out and report back.. Thanks!
hmmm
have you considered just making two separate books? (just starting to mess with og myself)
- Corey
Hey Corey, I'm trying to get
Hey Corey,
I'm trying to get a node type that would be selected under 'Omitted Content types' in admin/settings/og. This unfortunately only allows node types and not specific books. I want to have a heirarchal system of public books that would be excluded from the 'audience required: required' option so that my members can edit these books at ease (if the books were not excluded then I'd have to specify an audience for them, leading to breadcrumb issues)
Thus, I'm looking for a node type that has the features of the book module and that is why i am doing this..
Man that didn't sound that coherent huh..
brilliant! thnks
brilliant! thnks