You are here

interface JsCallbackInterface in JS Callback Handler 8.3

JsCallbackInterface.

Hierarchy

Expanded class hierarchy of JsCallbackInterface

All classes that implement JsCallbackInterface

File

src/Plugin/Js/JsCallbackInterface.php, line 10

Namespace

Drupal\js\Plugin\Js
View source
interface JsCallbackInterface extends PluginInspectionInterface {

  /**
   * Access callback.
   *
   * @return bool
   *   TRUE if the callback can be accessed, FALSE otherwise.
   */
  public function access();

  /**
   * Message to show when access to the callback has been denied.
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup
   */
  public function accessDeniedMessage();

  /**
   * Message to show when user is anonymous and callback requires CSRF token.
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup
   */
  public function anonymousUserMessage();

  /**
   * Calls a method on the callback, providing necessary converted parameters.
   *
   * @param string $method
   *   The method name to call.
   *
   * @return mixed
   *   The result from calling the method.
   */
  public function call($method);

  /**
   * Flag indicating whether or not the callback should capture printed output.
   *
   * @return bool
   */
  public function captureOutput();

  /**
   * Flag indicating whether callback should validate a CSRF token.
   *
   * @return bool
   */
  public function csrfToken();

  /**
   * Executes the callback.
   *
   * @param mixed ...
   *   Any number of arguments can be passed here.
   *
   * @return mixed
   *   The content to return.
   */
  public function execute();

  /**
   * An indexed array of allowed HTTP methods.
   *
   * @return array
   */
  public function getAllowedMethods();

  /**
   * An associative array of parameters.
   *
   * @return array
   */
  public function getParameters();

  /**
   * Retrieves the callback's response handler.
   *
   * @return \Drupal\js\JsResponse
   */
  public function getResponse();

  /**
   * The human readable title of the callback, if set.
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup|null
   *   The title or NULL if not set.
   */
  public function getTitle();

  /**
   * Message to show when an invalid CSRF token was provided.
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup
   */
  public function invalidTokenMessage();

  /**
   * Message to show when a callback was requested with an invalid HTTP method.
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup
   */
  public function methodNotAllowedMessage();

  /**
   * Sets the title for the callback.
   *
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup|string $title
   *   The title to set.
   *
   * @return $this
   */
  public function setTitle($title = '');

  /**
   * Validates the callback.
   *
   * @param mixed ...
   *   Any number of arguments can be passed here.
   *
   * @return mixed
   *   The content to return.
   */
  public function validate();

}

Members

Namesort descending Modifiers Type Description Overrides
JsCallbackInterface::access public function Access callback. 1
JsCallbackInterface::accessDeniedMessage public function Message to show when access to the callback has been denied. 1
JsCallbackInterface::anonymousUserMessage public function Message to show when user is anonymous and callback requires CSRF token. 1
JsCallbackInterface::call public function Calls a method on the callback, providing necessary converted parameters. 1
JsCallbackInterface::captureOutput public function Flag indicating whether or not the callback should capture printed output. 1
JsCallbackInterface::csrfToken public function Flag indicating whether callback should validate a CSRF token. 1
JsCallbackInterface::execute public function Executes the callback. 2
JsCallbackInterface::getAllowedMethods public function An indexed array of allowed HTTP methods. 1
JsCallbackInterface::getParameters public function An associative array of parameters. 1
JsCallbackInterface::getResponse public function Retrieves the callback's response handler. 1
JsCallbackInterface::getTitle public function The human readable title of the callback, if set. 1
JsCallbackInterface::invalidTokenMessage public function Message to show when an invalid CSRF token was provided. 1
JsCallbackInterface::methodNotAllowedMessage public function Message to show when a callback was requested with an invalid HTTP method. 1
JsCallbackInterface::setTitle public function Sets the title for the callback. 1
JsCallbackInterface::validate public function Validates the callback. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2