public function AssignOwnerNode::validateConfigurationForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/node/src/Plugin/Action/AssignOwnerNode.php \Drupal\node\Plugin\Action\AssignOwnerNode::validateConfigurationForm()
Form validation handler.
Parameters
array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the complete form.
Overrides ConfigurableActionBase::validateConfigurationForm
File
- core/
modules/ node/ src/ Plugin/ Action/ AssignOwnerNode.php, line 124 - Contains \Drupal\node\Plugin\Action\AssignOwnerNode.
Class
- AssignOwnerNode
- Assigns ownership of a node to a user.
Namespace
Drupal\node\Plugin\ActionCode
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, array(
':name' => $form_state
->getValue('owner_uid'),
))
->fetchField();
if (!$exists) {
$form_state
->setErrorByName('owner_uid', t('Enter a valid username.'));
}
}