You are here

public function ConfigurableResourceType::__construct in JSON:API Extras 8

Instantiates a ResourceType object.

Parameters

string $entity_type_id: An entity type ID.

string $bundle: A bundle.

string $deserialization_target_class: The deserialization target class.

\Drupal\jsonapi_extras\Entity\JsonapiResourceConfig $resource_config: The configuration entity.

\Drupal\jsonapi_extras\Plugin\ResourceFieldEnhancerManager $enhancer_manager: Plugin manager for enhancers.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The configuration factory.

Overrides ResourceType::__construct

File

src/ResourceType/ConfigurableResourceType.php, line 53

Class

ConfigurableResourceType
Defines a configurable resource type.

Namespace

Drupal\jsonapi_extras\ResourceType

Code

public function __construct($entity_type_id, $bundle, $deserialization_target_class, JsonapiResourceConfig $resource_config, ResourceFieldEnhancerManager $enhancer_manager, ConfigFactoryInterface $config_factory) {
  parent::__construct($entity_type_id, $bundle, $deserialization_target_class, (bool) $resource_config
    ->get('disabled'));
  $this->jsonapiResourceConfig = $resource_config;
  $this->enhancerManager = $enhancer_manager;
  $this->configFactory = $config_factory;
  if ($resource_config
    ->get('resourceType')) {

    // Set the type name.
    $this->typeName = $resource_config
      ->get('resourceType');
  }
}