You are here

public function ExampleController::createPost in HTTP Client Manager 8

Same name and namespace in other branches
  1. 8.2 modules/http_client_manager_example/src/Controller/ExampleController.php \Drupal\http_client_manager_example\Controller\ExampleController::createPost()

Create post.

Return value

array The service response.

1 string reference to 'ExampleController::createPost'
http_client_manager_example.routing.yml in modules/http_client_manager_example/http_client_manager_example.routing.yml
modules/http_client_manager_example/http_client_manager_example.routing.yml

File

modules/http_client_manager_example/src/Controller/ExampleController.php, line 117

Class

ExampleController
Class ExampleController.

Namespace

Drupal\http_client_manager_example\Controller

Code

public function createPost() {
  if ($request = HttpConfigRequest::load('create_post')) {
    $response = '<pre>' . print_r($request
      ->execute(), TRUE) . '</pre>';
  }
  else {
    $response = $this
      ->t('Unable to load "create_post" configured request.');
  }
  return [
    '#type' => 'markup',
    '#markup' => $response,
  ];
}