You are here

protected function FormatterManager::getPluginByName in RESTful 7.2

Gets a plugin by name initializing the resource.

Parameters

string $name: The formatter name.

Return value

FormatterInterface The plugin.

1 call to FormatterManager::getPluginByName()
FormatterManager::negotiateFormatter in src/Formatter/FormatterManager.php
Helper function to get the default output format from the current request.

File

src/Formatter/FormatterManager.php, line 218
Contains \Drupal\restful\Formatter\FormatterManager

Class

FormatterManager
Class FormatterManager.

Namespace

Drupal\restful\Formatter

Code

protected function getPluginByName($name) {

  /* @var FormatterInterface $formatter */
  $formatter = $this->plugins
    ->get($name);
  if ($this->resource) {
    $formatter
      ->setResource($this->resource);
  }
  return $formatter;
}