diff --git a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
index 0691239dfa..79744009f6 100644
--- a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
+++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
@@ -4,6 +4,7 @@
 
 use Drupal\Component\Utility\Crypt;
 use Drupal\Component\Utility\Tags;
+use Drupal\Core\Entity\EntityForm;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface;
 use Drupal\Core\Entity\EntityReferenceSelection\SelectionWithAutocreateInterface;
@@ -127,6 +128,20 @@ public static function processEntityAutocomplete(array &$element, FormStateInter
     // Store the selection settings in the key/value store and pass a hashed key
     // in the route parameters.
     $selection_settings = isset($element['#selection_settings']) ? $element['#selection_settings'] : [];
+
+    // Put entity into settings.
+    $form_object = $form_state->getFormObject();
+    if (isset($form_object) && $form_object instanceof EntityForm) {
+      $entity = $form_object->getEntity();
+      if (isset($entity)) {
+        $storage = $form_state->getStorage();
+        if (isset($storage['group'])) {
+          $entity->parent_group = $storage['group'];
+        }
+        $selection_settings['entity'] = $entity;
+      }
+    }
+
     $data = serialize($selection_settings) . $element['#target_type'] . $element['#selection_handler'];
     $selection_settings_key = Crypt::hmacBase64($data, Settings::getHashSalt());
 
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php
index a559d9e870..67a5a70c54 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
 
+use Drupal\Core\Entity\EntityForm;
 use Drupal\Core\Entity\FieldableEntityInterface;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Field\FieldFilteredMarkup;
@@ -43,6 +44,25 @@ public function __construct($plugin_id, $plugin_definition, FieldDefinitionInter
    * {@inheritdoc}
    */
   public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
+    // Add form object to field definition.
+    $field_definition = $items->getFieldDefinition();
+
+    // Put entity into settings.
+    $form_object = $form_state->getFormObject();
+    if (isset($form_object) && $form_object instanceof EntityForm) {
+      $entity = $form_object->getEntity();
+      if (isset($entity)) {
+        $storage = $form_state->getStorage();
+        if (isset($storage['group'])) {
+          $entity->parent_group = $storage['group'];
+        }
+
+        $setting = $field_definition->getSetting('handler_settings');
+        $setting['entity'] = $entity;
+        $field_definition->setSetting('handler_settings', $setting);
+      }
+    }
+
     // Prepare some properties for the child methods to build the actual form
     // element.
     $this->required = $element['#required'];
diff --git a/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php b/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php
index 79707af10a..d3758a65ba 100644
--- a/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php
+++ b/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php
@@ -3,15 +3,18 @@
 namespace Drupal\views\Plugin\EntityReferenceSelection;
 
 use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
+use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginBase;
-use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
+use Drupal\Core\Render\BubbleableMetadata;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Url;
 use Drupal\views\Views;
 use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Core\Utility\Token;
 
 /**
  * Plugin implementation of the 'selection' entity_reference.
@@ -59,6 +62,13 @@ class ViewsSelection extends SelectionPluginBase implements ContainerFactoryPlug
    */
   protected $currentUser;
 
+  /**
+   * The token service.
+   *
+   * @var \Drupal\Core\Utility\Token
+   */
+  protected $token;
+
   /**
    * Constructs a new ViewsSelection object.
    *
@@ -74,13 +84,16 @@ class ViewsSelection extends SelectionPluginBase implements ContainerFactoryPlug
    *   The module handler service.
    * @param \Drupal\Core\Session\AccountInterface $current_user
    *   The current user.
+   * @param \Drupal\Core\Utility\Token
+   *   The token service.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user, Token $token) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
 
     $this->entityTypeManager = $entity_type_manager;
     $this->moduleHandler = $module_handler;
     $this->currentUser = $current_user;
+    $this->token = $token;
   }
 
   /**
@@ -93,7 +106,8 @@ public static function create(ContainerInterface $container, array $configuratio
       $plugin_definition,
       $container->get('entity_type.manager'),
       $container->get('module_handler'),
-      $container->get('current_user')
+      $container->get('current_user'),
+      $container->get('token')
     );
   }
 
@@ -156,7 +170,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
         '#title' => $this->t('View arguments'),
         '#default_value' => $default,
         '#required' => FALSE,
-        '#description' => $this->t('Provide a comma separated list of arguments to pass to the view.'),
+        '#description' => $this->t('Provide a comma separated list of arguments to pass to the view.') . '<br />' . $this->t('This field supports tokens.'),
       ];
     }
     else {
@@ -220,7 +234,7 @@ protected function initializeView($match = NULL, $match_operator = 'CONTAINS', $
    */
   public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
     $display_name = $this->getConfiguration()['view']['display_name'];
-    $arguments = $this->getConfiguration()['view']['arguments'];
+    $arguments = $this->handleArgs($this->getConfiguration()['view']['arguments']);
     $result = [];
     if ($this->initializeView($match, $match_operator, $limit)) {
       // Get the results.
@@ -250,7 +264,7 @@ public function countReferenceableEntities($match = NULL, $match_operator = 'CON
    */
   public function validateReferenceableEntities(array $ids) {
     $display_name = $this->getConfiguration()['view']['display_name'];
-    $arguments = $this->getConfiguration()['view']['arguments'];
+    $arguments = $this->handleArgs($this->getConfiguration()['view']['arguments'], FALSE);
     $result = [];
     if ($this->initializeView(NULL, 'CONTAINS', 0, $ids)) {
       // Get the results.
@@ -289,4 +303,56 @@ public static function settingsFormValidate($element, FormStateInterface $form_s
     $form_state->setValueForElement($element, $value);
   }
 
+  /**
+   * Handles replacing tokens in arguments for views.
+   *
+   * Replaces tokens using Token::replace.
+   *
+   * @param array $args
+   *   An array of arguments that may contain tokens.
+   * @param bool $bubble_cacheable_metadata
+   *   If TRUE the cachebility metadata emitted during token replacement will be
+   *   bubbled to the render context. If FALSE then the it will not in order to
+   *   prevent leaked cacheability metadata during early rendering.
+   *
+   * @return array
+   *   The arguments to be sent to the View.
+   */
+  protected function handleArgs($args, $bubble_cacheable_metadata = TRUE) {
+    $entities = [];
+    if (isset($this->configuration['handler_settings']['entity'])) {
+      $entities[] = $this->configuration['handler_settings']['entity'];
+    }
+    if (isset($this->configuration['entity'])) {
+      $entities[] = $this->configuration['entity'];
+    }
+
+    $data = [];
+    foreach ($entities as $entity) {
+      $token_type = $entity->getEntityTypeId();
+
+      // Taxonomy term token type doesn't match the entity type's machine name.
+      if ($token_type === 'taxonomy_term') {
+        $token_type = 'term';
+      }
+
+      if (!isset($data[$token_type])) {
+        $data[$token_type] = $entity;
+      }
+    }
+
+    // If cacheability metadata should not be bubbled then we need to pass in
+    // our own BubbleableMetadata which will prevent any metadata generated from
+    // automatically bubbling to the render context.
+    $bubbleable_metadata = $bubble_cacheable_metadata ? NULL : new BubbleableMetadata();
+
+    // Replace tokens for each argument.
+    foreach ($args as $key => $arg) {
+      $value = $this->token->replace($arg, $data, ['clear' => TRUE], $bubbleable_metadata);
+      $args[$key] = !empty($value) ? $value : NULL;
+    }
+
+    return $args;
+  }
+
 }
