Commit f56023cc authored by Nicholas Thompson's avatar Nicholas Thompson
Browse files

#1253640 - Updating a Node to empty title doesn't delete the value.

parent dd9cfda2
......@@ -402,8 +402,15 @@ function page_title_node_insert($node) {
* Implement hook_node_update().
*/
function page_title_node_update($node) {
if (user_access('set page title') && isset($node->page_title) && drupal_strlen(trim($node->page_title)) > 0) {
db_merge('page_title')->key(array('type' => 'node', 'id' => $node->nid))->fields(array('page_title' => $node->page_title))->execute();
if (user_access('set page title') && isset($node->page_title)) {
// If there is content to the Page Title, 'merge' it (ie, either UPDATE or INSERT)
if (drupal_strlen(trim($node->page_title)) > 0) {
db_merge('page_title')->key(array('type' => 'node', 'id' => $node->nid))->fields(array('page_title' => $node->page_title))->execute();
}
// Otherwise, delete the row (if there is one)
else {
db_delete('page_title')->condition('type', 'node')->condition('id', $node->nid)->execute();
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment