/**
  * Data provider factory.
  *
  * @return DataProviderEntityInterface
  *   The data provider for this resource.
  *
  * @throws ServerConfigurationException
  */
 public function dataProviderFactory()
 {
     $plugin_definition = $this->getPluginDefinition();
     $field_definitions = $this->getFieldDefinitions();
     if (!empty($plugin_definition['dataProvider']['viewMode'])) {
         $field_definitions_array = $this->viewModeFields($plugin_definition['dataProvider']['viewMode']);
         $field_definitions = ResourceFieldCollection::factory($field_definitions_array, $this->getRequest());
     }
     $class_name = $this->dataProviderClassName();
     if (!class_exists($class_name)) {
         throw new ServerConfigurationException(sprintf('The DataProvider could not be found for this resource: %s.', $this->getResourceMachineName()));
     }
     return new $class_name($this->getRequest(), $field_definitions, $this->getAccount(), $this->getPluginId(), $this->getPath(), $plugin_definition['dataProvider']);
 }
 /**
  * Initialize the empty resource field collection to bundle the output.
  *
  * @param mixed $identifier
  *   The ID of thing being viewed.
  *
  * @return ResourceFieldCollectionInterface
  *   The collection of fields.
  *
  * @throws \Drupal\restful\Exception\NotFoundException
  */
 protected function initResourceFieldCollection($identifier)
 {
     $resource_field_collection = new ResourceFieldCollection(array(), $this->getRequest());
     $interpreter = $this->initDataInterpreter($identifier);
     $resource_field_collection->setInterpreter($interpreter);
     $id_field_name = empty($this->options['idField']) ? 'id' : $this->options['idField'];
     $resource_field_collection->setIdField($this->fieldDefinitions->get($id_field_name));
     $resource_field_collection->setResourceId($this->pluginId);
     return $resource_field_collection;
 }
 /**
  * Constructs a Drupal\Component\Plugin\PluginBase object.
  *
  * @param array $configuration
  *   A configuration array containing information about the plugin instance.
  * @param string $plugin_id
  *   The plugin_id for the plugin instance.
  * @param mixed $plugin_definition
  *   The plugin implementation definition.
  */
 public function __construct(array $configuration, $plugin_id, $plugin_definition)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->fieldDefinitions = ResourceFieldCollection::factory($this->processPublicFields($this->publicFields()), $this->getRequest());
     $this->initAuthenticationManager();
 }