You are here

interface FormatterManagerInterface in RESTful 7.2

Hierarchy

Expanded class hierarchy of FormatterManagerInterface

All classes that implement FormatterManagerInterface

1 file declares its use of FormatterManagerInterface
RestfulManager.php in src/RestfulManager.php
Contains \Drupal\restful\RestfulManager.

File

src/Formatter/FormatterManagerInterface.php, line 13
Contains \Drupal\restful\Formatter\FormatterManagerInterface

Namespace

Drupal\restful\Formatter
View source
interface FormatterManagerInterface {

  /**
   * Sets the resource.
   *
   * @param ResourceInterface $resource
   *   The resource.
   */
  public function setResource($resource);

  /**
   * Call the output format on the given data.
   *
   * @param array $data
   *   The array of data to format.
   * @param string $formatter_name
   *   The name of the formatter for the current resource. Leave it NULL to use
   *   the Accept headers.
   *
   * @return string
   *   The formatted output.
   */
  public function format(array $data, $formatter_name = NULL);

  /**
   * Call the output format on the given data.
   *
   * @param array $data
   *   The array of data to render.
   * @param string $formatter_name
   *   The name of the formatter for the current resource. Leave it NULL to use
   *   the Accept headers.
   *
   * @return string
   *   The rendered output.
   */
  public function render(array $data, $formatter_name = NULL);

  /**
   * Helper function to get the default output format from the current request.
   *
   * @param string $accept
   *   The Accept header.
   * @param string $formatter_name
   *   The name of the formatter for the current resource.
   *
   * @return FormatterInterface
   *   The formatter plugin to use.
   */
  public function negotiateFormatter($accept, $formatter_name = NULL);

  /**
   * Returns the plugins.
   *
   * @return FormatterPluginCollection
   */
  public function getPlugins();

  /**
   * Returns the plugin instance for the given instance ID.
   *
   * @return FormatterInterface
   */
  public function getPlugin($instance_id);

}

Members

Namesort descending Modifiers Type Description Overrides
FormatterManagerInterface::format public function Call the output format on the given data. 1
FormatterManagerInterface::getPlugin public function Returns the plugin instance for the given instance ID. 1
FormatterManagerInterface::getPlugins public function Returns the plugins. 1
FormatterManagerInterface::negotiateFormatter public function Helper function to get the default output format from the current request. 1
FormatterManagerInterface::render public function Call the output format on the given data. 1
FormatterManagerInterface::setResource public function Sets the resource. 1