You are here

protected function DynamicEntityReferenceTest::createAutoCompletePath in Dynamic Entity Reference 8

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/DynamicEntityReferenceTest.php \Drupal\Tests\dynamic_entity_reference\FunctionalJavascript\DynamicEntityReferenceTest::createAutoCompletePath()

Creates auto complete path for the given target type.

Parameters

string $target_type: The entity type id.

Return value

string Auto complete paths for the target type.

1 call to DynamicEntityReferenceTest::createAutoCompletePath()
DynamicEntityReferenceTest::testFieldSettings in tests/src/FunctionalJavascript/DynamicEntityReferenceTest.php
Tests field settings of dynamic entity reference field.

File

tests/src/FunctionalJavascript/DynamicEntityReferenceTest.php, line 265

Class

DynamicEntityReferenceTest
Ensures that Dynamic Entity References field works correctly.

Namespace

Drupal\Tests\dynamic_entity_reference\FunctionalJavascript

Code

protected function createAutoCompletePath($target_type) {
  $selection_settings = [
    'match_operator' => 'CONTAINS',
    'match_limit' => 10,
  ];
  $data = serialize($selection_settings) . $target_type . "default:{$target_type}";
  $selection_settings_key = Crypt::hmacBase64($data, Settings::getHashSalt());
  return Url::fromRoute('system.entity_autocomplete', [
    'target_type' => $target_type,
    'selection_handler' => "default:{$target_type}",
    'selection_settings_key' => $selection_settings_key,
  ])
    ->toString();
}