You are here

function blogapi_blogger_new_post in Blog API 8

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

Callback for blogger.newPost.

Parameters

$hash: Unused variable.

$ct: Content type machine name.

$username: Drupal username.

$pass: Drupal password.

$content: Node contents.

$publish: Bool variable with publish status.

Return value

mixed Return a response.

1 string reference to 'blogapi_blogger_new_post'
BloggerProvider::getMethods in modules/blogapi_blogger/src/Plugin/BlogapiProvider/BloggerProvider.php
Returns implemented methods.

File

modules/blogapi_blogger/blogapi_blogger.module, line 157

Code

function blogapi_blogger_new_post($hash, $ct, $username, $pass, $content, $publish) {
  $communicator = \Drupal::service('service.communicator.blogapi');
  $data = [
    'type' => $ct,
    'publish' => $publish,
    'title' => blogapi_blogger_get_title($content),
    'body' => preg_replace('/<title>.*?<\\/title>/i', '', $content),
  ];
  return $communicator
    ->newPost($ct, $username, $pass, $data);
}