function AssignOwnerNode::validateConfigurationForm

Same name in other branches
  1. 9 core/modules/node/src/Plugin/Action/AssignOwnerNode.php \Drupal\node\Plugin\Action\AssignOwnerNode::validateConfigurationForm()
  2. 8.9.x core/modules/node/src/Plugin/Action/AssignOwnerNode.php \Drupal\node\Plugin\Action\AssignOwnerNode::validateConfigurationForm()
  3. 10 core/modules/action/src/Plugin/Action/AssignOwnerNode.php \Drupal\action\Plugin\Action\AssignOwnerNode::validateConfigurationForm()

Overrides ConfigurableActionBase::validateConfigurationForm

File

core/modules/node/src/Plugin/Action/AssignOwnerNode.php, line 120

Class

AssignOwnerNode
Assigns ownership of a node to a user.

Namespace

Drupal\node\Plugin\Action

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
    $exists = (bool) $this->connection
        ->queryRange('SELECT 1 FROM {users_field_data} WHERE [uid] = :uid AND [default_langcode] = 1', 0, 1, [
        ':uid' => $form_state->getValue('owner_uid'),
    ])
        ->fetchField();
    if (!$exists) {
        $form_state->setErrorByName('owner_uid', $this->t('Enter a valid username.'));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.