function _book_helper_fill_link in Book helper 7
Fill the menu link and custom title values into the node.
Return value
TRUE if anything was changed, else FALSE
2 calls to _book_helper_fill_link()
- book_helper_admin_edit_submit in ./
book_helper.admin.inc - Handle submission of the book administrative page form.
- book_helper_outline_submit in ./
book_helper.module
File
- ./
book_helper.module, line 316 - Improves Drupal's core book module's functionality.
Code
function _book_helper_fill_link($node, &$values) {
// Populate node from form values.
if (isset($values['book']['hidden'])) {
// Value of 'hidden' on the form means "enabled", so is inverse of hidden flag in menu.
$hidden = $values['book']['hidden'] ? 0 : 1;
}
// Set the $changed flag if any value has changed.
$changed = isset($hidden) && $node->book['hidden'] != $hidden || isset($values['book']['bid']) && $node->book['bid'] != $values['book']['bid'] || $node->book['plid'] != $values['book']['plid'] || $node->book['weight'] != $values['book']['weight'] || $node->book_helper['link_title_sync'] != $values['book']['link_title_sync'] || $node->book_helper['link_title_custom'] != $values['book']['link_title'];
// If anything changed, set all values.
if ($changed) {
if (isset($hidden)) {
$node->book['hidden'] = $hidden;
}
if (isset($values['book']['bid'])) {
$node->book['bid'] = $values['book']['bid'];
}
$node->book['plid'] = $values['book']['plid'];
$node->book['weight'] = $values['book']['weight'];
$node->book_helper['link_title_sync'] = $values['book']['link_title_sync'];
$node->book_helper['link_title_custom'] = $values['book']['link_title'];
}
return $changed;
}