Skip to content
Snippets Groups Projects
Commit 93d496ba authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #41276 by walkah/chx: blog api fixes for new forms api.

parent 21328835
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -214,8 +214,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
$edit['body'] = $content;
}
$node = node_validate($edit);
node_validate($edit);
if ($errors = form_get_errors()) {
return blogapi_error(implode("\n", $errors));
}
......@@ -224,6 +223,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
return blogapi_error(t('You do not have permission to create the type of post you wanted to create.'));
}
$node = node_submit($edit);
node_save($node);
if ($node->nid) {
watchdog('content', t('%type: added %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
......@@ -269,8 +269,7 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont
$node->body = $content;
}
$node = node_validate($node);
node_validate($node);
if ($errors = form_get_errors()) {
return blogapi_error(implode("\n", $errors));
}
......@@ -279,6 +278,8 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont
foreach ($terms as $term) {
$node->taxonomy[] = $term->tid;
}
$node = node_submit($node);
node_save($node);
if ($node->nid) {
watchdog('content', t('%type: updated %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
......
......@@ -214,8 +214,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
$edit['body'] = $content;
}
$node = node_validate($edit);
node_validate($edit);
if ($errors = form_get_errors()) {
return blogapi_error(implode("\n", $errors));
}
......@@ -224,6 +223,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
return blogapi_error(t('You do not have permission to create the type of post you wanted to create.'));
}
$node = node_submit($edit);
node_save($node);
if ($node->nid) {
watchdog('content', t('%type: added %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
......@@ -269,8 +269,7 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont
$node->body = $content;
}
$node = node_validate($node);
node_validate($node);
if ($errors = form_get_errors()) {
return blogapi_error(implode("\n", $errors));
}
......@@ -279,6 +278,8 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont
foreach ($terms as $term) {
$node->taxonomy[] = $term->tid;
}
$node = node_submit($node);
node_save($node);
if ($node->nid) {
watchdog('content', t('%type: updated %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment