You are here

public function ReferencePreviewConverter::convert in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/src/ParamConverter/ReferencePreviewConverter.php \Drupal\bibcite_entity\ParamConverter\ReferencePreviewConverter::convert()

Converts path variables to their corresponding objects.

Parameters

mixed $value: The raw value.

mixed $definition: The parameter definition provided in the route options.

string $name: The name of the parameter.

array $defaults: The route defaults array.

Return value

mixed|null The converted parameter value.

Overrides ParamConverterInterface::convert

File

modules/bibcite_entity/src/ParamConverter/ReferencePreviewConverter.php, line 34

Class

ReferencePreviewConverter
Provides upcasting for a reference entity in preview.

Namespace

Drupal\bibcite_entity\ParamConverter

Code

public function convert($value, $definition, $name, array $defaults) {
  $store = $this->tempStoreFactory
    ->get('bibcite_reference_preview');
  if ($form_state = $store
    ->get($value)) {
    return $form_state
      ->getFormObject()
      ->getEntity();
  }
}