You are here

public function JsCallbackBase::methodNotAllowedMessage in JS Callback Handler 8.3

Message to show when a callback was requested with an invalid HTTP method.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup

Overrides JsCallbackInterface::methodNotAllowedMessage

File

src/Plugin/Js/JsCallbackBase.php, line 218

Class

JsCallbackBase
Base JsCallback class.

Namespace

Drupal\js\Plugin\Js

Code

public function methodNotAllowedMessage() {
  $allowed = $this
    ->getAllowedMethods();
  return $this
    ->formatPlural(count($allowed), 'Method not allowed: %method. Only the %allowed_methods method is allowed. Please contact the site administrator if this problem persists.', 'Method not allowed: %method. Only the %allowed_methods methods are allowed. Please contact the site administrator if this problem persists.', [
    '%method' => $this->js
      ->getRequest()
      ->getMethod(),
    '%allowed_methods' => implode(', ', $allowed),
  ]);
}