protected function JsonapiResourceConfig::urlRouteParameters in JSON:API Extras 8
Same name and namespace in other branches
- 8.3 src/Entity/JsonapiResourceConfig.php \Drupal\jsonapi_extras\Entity\JsonapiResourceConfig::urlRouteParameters()
- 8.2 src/Entity/JsonapiResourceConfig.php \Drupal\jsonapi_extras\Entity\JsonapiResourceConfig::urlRouteParameters()
Gets an array of placeholders for this entity.
Individual entity classes may override this method to add additional placeholders if desired. If so, they should be sure to replicate the property caching logic.
Parameters
string $rel: The link relationship type, for example: canonical or edit-form.
Return value
array An array of URI placeholders.
Overrides EntityBase::urlRouteParameters
File
- src/
Entity/ JsonapiResourceConfig.php, line 95
Class
- JsonapiResourceConfig
- Defines the JSON API Resource Config entity.
Namespace
Drupal\jsonapi_extras\EntityCode
protected function urlRouteParameters($rel) {
$uri_route_parameters = parent::urlRouteParameters($rel);
// The add-form route depends on entity_type_id and bundle.
if (in_array($rel, [
'add-form',
])) {
$parameters = explode('--', $this->id);
$uri_route_parameters['entity_type_id'] = $parameters[0];
$uri_route_parameters['bundle'] = $parameters[1];
}
return $uri_route_parameters;
}