function node_import_check_book_reference in Node import 6
Check whether the value is a book (by NID or Title).
Uses: nothing.
Related topics
1 string reference to 'node_import_check_book_reference'
- book_node_import_fields_alter in supported/
book.inc - Implementation of hook_node_import_fields_alter().
File
- supported/
book.inc, line 69 - Support file for the core book module.
Code
function node_import_check_book_reference(&$value, $field, $options, $preview) {
static $first_run = TRUE;
if ($first_run) {
foreach (node_import_extract_property(book_get_books()) as $nid => $title) {
node_import_set_object('book', $title, $nid);
node_import_set_object('book', $nid, $nid);
node_import_set_object('book:title', $nid, $title);
}
$first_run = FALSE;
}
if ($value == '<none>') {
// Not in a book.
$value = '';
return TRUE;
}
else {
if ($value == '<new>') {
// A new top-level book.
$value = 'new';
return TRUE;
}
else {
if (($bid = node_import_get_object('book', $value)) !== NULL) {
// An existing book.
$value = $bid;
return TRUE;
}
}
}
node_import_input_error(t('Input error: %value is not allowed for %name (not a book).', array(
'%value' => $value,
'%name' => $field['title'],
)));
return FALSE;
}