Loading src/Controller/AjaxController.php +14 −3 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Core\Ajax\AjaxResponse; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\KeyValueStore\KeyValueStoreInterface; use Drupal\Core\Render\RendererInterface; use Drupal\Core\Session\AccountProxyInterface; use Drupal\Core\Site\Settings; Loading Loading @@ -80,6 +81,13 @@ class AjaxController extends ControllerBase implements AjaxControllerInterface { */ protected $privateMessageService; /** * The key/value storage collection. * * @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface */ protected $keyValueStore; /** * Constructs a AjaxController object. * Loading @@ -102,7 +110,8 @@ class AjaxController extends ControllerBase implements AjaxControllerInterface { EntityTypeManagerInterface $entityTypeManager, ConfigFactoryInterface $configFactory, AccountProxyInterface $currentUser, PrivateMessageServiceInterface $privateMessageService PrivateMessageServiceInterface $privateMessageService, KeyValueStoreInterface $keyValueStore ) { $this->renderer = $renderer; $this->requestStack = $requestStack; Loading @@ -111,6 +120,7 @@ class AjaxController extends ControllerBase implements AjaxControllerInterface { $this->configFactory = $configFactory; $this->currentUser = $currentUser; $this->privateMessageService = $privateMessageService; $this->keyValueStore = $keyValueStore; } /** Loading @@ -123,7 +133,8 @@ class AjaxController extends ControllerBase implements AjaxControllerInterface { $container->get('entity_type.manager'), $container->get('config.factory'), $container->get('current_user'), $container->get('private_message.service') $container->get('private_message.service'), $container->get('keyvalue')->get('entity_autocomplete') ); } Loading Loading @@ -184,7 +195,7 @@ class AjaxController extends ControllerBase implements AjaxControllerInterface { // Selection settings are passed in as a hashed key of a serialized array // stored in the key/value store. $selection_settings = \Drupal::keyValue('entity_autocomplete')->get($selection_settings_key, FALSE); $selection_settings = $this->keyValueStore->get($selection_settings_key, FALSE); if ($selection_settings !== FALSE) { $selection_settings_hash = Crypt::hmacBase64(serialize($selection_settings) . $target_type . $selection_handler, Settings::getHashSalt()); if (!hash_equals($selection_settings_hash, $selection_settings_key)) { Loading Loading
src/Controller/AjaxController.php +14 −3 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Core\Ajax\AjaxResponse; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\KeyValueStore\KeyValueStoreInterface; use Drupal\Core\Render\RendererInterface; use Drupal\Core\Session\AccountProxyInterface; use Drupal\Core\Site\Settings; Loading Loading @@ -80,6 +81,13 @@ class AjaxController extends ControllerBase implements AjaxControllerInterface { */ protected $privateMessageService; /** * The key/value storage collection. * * @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface */ protected $keyValueStore; /** * Constructs a AjaxController object. * Loading @@ -102,7 +110,8 @@ class AjaxController extends ControllerBase implements AjaxControllerInterface { EntityTypeManagerInterface $entityTypeManager, ConfigFactoryInterface $configFactory, AccountProxyInterface $currentUser, PrivateMessageServiceInterface $privateMessageService PrivateMessageServiceInterface $privateMessageService, KeyValueStoreInterface $keyValueStore ) { $this->renderer = $renderer; $this->requestStack = $requestStack; Loading @@ -111,6 +120,7 @@ class AjaxController extends ControllerBase implements AjaxControllerInterface { $this->configFactory = $configFactory; $this->currentUser = $currentUser; $this->privateMessageService = $privateMessageService; $this->keyValueStore = $keyValueStore; } /** Loading @@ -123,7 +133,8 @@ class AjaxController extends ControllerBase implements AjaxControllerInterface { $container->get('entity_type.manager'), $container->get('config.factory'), $container->get('current_user'), $container->get('private_message.service') $container->get('private_message.service'), $container->get('keyvalue')->get('entity_autocomplete') ); } Loading Loading @@ -184,7 +195,7 @@ class AjaxController extends ControllerBase implements AjaxControllerInterface { // Selection settings are passed in as a hashed key of a serialized array // stored in the key/value store. $selection_settings = \Drupal::keyValue('entity_autocomplete')->get($selection_settings_key, FALSE); $selection_settings = $this->keyValueStore->get($selection_settings_key, FALSE); if ($selection_settings !== FALSE) { $selection_settings_hash = Crypt::hmacBase64(serialize($selection_settings) . $target_type . $selection_handler, Settings::getHashSalt()); if (!hash_equals($selection_settings_hash, $selection_settings_key)) { Loading