You are here

public function FormatterManager::__construct in RESTful 7.2

Constructs FormatterManager.

Parameters

ResourceInterface $resource: TODO: Remove this coupling. The resource.

File

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

Class

FormatterManager
Class FormatterManager.

Namespace

Drupal\restful\Formatter

Code

public function __construct($resource = NULL) {
  $this->resource = $resource;
  $manager = FormatterPluginManager::create();
  $options = array();
  foreach ($manager
    ->getDefinitions() as $plugin_id => $plugin_definition) {

    // Since there is only one instance per plugin_id use the plugin_id as
    // instance_id.
    $options[$plugin_id] = $plugin_definition;
  }
  $this->plugins = new FormatterPluginCollection($manager, $options);
}