You are here

function blogapi_metaweblog_edit_post in Blog API 8

Same name and namespace in other branches
  1. 7.2 modules/blogapi_metaweblog/blogapi_metaweblog.module \blogapi_metaweblog_edit_post()
  2. 7 blogapi.module \blogapi_metaweblog_edit_post()

Callback for metaWeblog.editPost.

Parameters

$nid: The node ID.

$username: Drupal username.

$pass: Drupal password.

$data: The node contents.

$publish: Boolean Drupal publish status.

Return value

object|string BlogAPI response.

1 string reference to 'blogapi_metaweblog_edit_post'
MetaweblogProvider::getMethods in modules/blogapi_metaweblog/src/Plugin/BlogapiProvider/MetaweblogProvider.php
Returns implemented methods.

File

modules/blogapi_metaweblog/blogapi_metaweblog.module, line 65
Module file for blogapi_blogger.

Code

function blogapi_metaweblog_edit_post($nid, $username, $pass, $data, $publish) {
  $communicator = \Drupal::service('service.communicator.blogapi');
  $formatted = [
    'title' => $data['title'],
    'body' => $data['description'],
    'format' => $data['mt_convert_breaks'],
    'publish' => $publish,
    'comments' => blogapi_metaweblog_decode_comment_code($data['mt_allow_comments']),
  ];
  return $communicator
    ->editPost($nid, $username, $pass, $formatted);
}