EntityAutocompleteController.php 877 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace Drupal\materio_commerce\Controller;
  3. use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
  4. use Drupal\materio_commerce\EntityAutocompleteMatcher;
  5. use Symfony\Component\DependencyInjection\ContainerInterface;
  6. class EntityAutocompleteController extends \Drupal\system\Controller\EntityAutocompleteController {
  7. /**
  8. * The autocomplete matcher for entity references.
  9. */
  10. protected $matcher;
  11. /**
  12. * {@inheritdoc}
  13. */
  14. public function __construct(EntityAutocompleteMatcher $matcher, KeyValueStoreInterface $key_value) {
  15. $this->matcher = $matcher;
  16. $this->keyValue = $key_value;
  17. }
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public static function create(ContainerInterface $container) {
  22. return new static(
  23. $container->get('materio_commerce.autocomplete_matcher'),
  24. $container->get('keyvalue')->get('entity_autocomplete')
  25. );
  26. }
  27. }