// We want the literal %author placeholder to be emphasized in the error message.
form_set_error('recipient',$form_state,t('Enter a valid email address or use a token email address such as %author.',array('%author'=>'[node:author:mail]')));
$form_state->setErrorByName('recipient',t('Enter a valid email address or use a token email address such as %author.',array('%author'=>'[node:author:mail]')));
form_set_error('palette]['.$key,$form_state,t('You must enter a valid hexadecimal color value for %name.',array('%name'=>$form['color']['palette'][$key]['#title'])));
$form_state->setErrorByName('palette]['.$key,t('You must enter a valid hexadecimal color value for %name.',array('%name'=>$form['color']['palette'][$key]['#title'])));
form_set_error($name,$form_state,t('Translation is not supported if language is always one of: @locked_languages',array('@locked_languages'=>implode(', ',$locked_languages))));
$form_state->setErrorByName($name,t('Translation is not supported if language is always one of: @locked_languages',array('@locked_languages'=>implode(', ',$locked_languages))));
@@ -753,7 +753,7 @@ function content_translation_language_configuration_element_validate($element, F
// @todo Set the correct form element name as soon as the element parents
// are correctly set. We should be using NestedArray::getValue() but for
// now we cannot.
form_set_error('',$form_state,t('"Show language selector" is not compatible with translating content that has default language: %choice. Either do not hide the language selector or pick a specific language.',array('%choice'=>$locked_languages[$values['langcode']])));
$form_state->setErrorByName('',t('"Show language selector" is not compatible with translating content that has default language: %choice. Either do not hide the language selector or pick a specific language.',array('%choice'=>$locked_languages[$values['langcode']])));
form_set_error('content_translation][name',$form_state,t('The translation authoring username %name does not exist.',array('%name'=>$translation['name'])));
$form_state->setErrorByName('content_translation][name',t('The translation authoring username %name does not exist.',array('%name'=>$translation['name'])));
\Drupal::logger('file')->notice('The upload directory %directory for the file field !name could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.',array('%directory'=>$destination,'!name'=>$element['#field_name']));
form_set_error($upload_name,$form_state,t('The file could not be uploaded.'));
$form_state->setErrorByName($upload_name,t('The file could not be uploaded.'));
returnFALSE;
}
...
...
@@ -1456,7 +1456,7 @@ function file_managed_file_save_upload($element, FormStateInterface $form_state)
@@ -213,7 +213,7 @@ function forum_node_validate(EntityInterface $node, $form, FormStateInterface $f
}
$term=$item->entity;
if(!$term){
form_set_error('taxonomy_forums',$form_state,t('Select a forum.'));
$form_state->setErrorByName('taxonomy_forums',t('Select a forum.'));
continue;
}
$used=\Drupal::entityQuery('taxonomy_term')
...
...
@@ -223,7 +223,7 @@ function forum_node_validate(EntityInterface $node, $form, FormStateInterface $f
->count()
->execute();
if($used&&!empty($term->forum_container->value)){
form_set_error('taxonomy_forums',$form_state,t('The item %forum is a forum container, not a forum. Select one of the forums below instead.',array('%forum'=>$term->getName())));
$form_state->setErrorByName('taxonomy_forums',t('The item %forum is a forum container, not a forum. Select one of the forums below instead.',array('%forum'=>$term->getName())));
$exists=(bool)$this->connection->queryRange('SELECT 1 FROM {users_field_data} WHERE name = :name AND default_langcode = 1',0,1,array(':name'=>$form_state->getValue('owner_name')))->fetchField();
if(!$exists){
form_set_error('owner_name',$form_state,t('Enter a valid username.'));
$form_state->setErrorByName('owner_name',t('Enter a valid username.'));
form_set_error($key,$form_state,format_plural(\Drupal::config('search.settings')->get('index.minimum_word_size'),'You must include at least one positive keyword with 1 character or more.','You must include at least one positive keyword with @count characters or more.'));
$form_state->setErrorByName($key,format_plural(\Drupal::config('search.settings')->get('index.minimum_word_size'),'You must include at least one positive keyword with 1 character or more.','You must include at least one positive keyword with @count characters or more.'));
// If the directory does not exists and cannot be created.
form_set_error($form_element['#parents'][0],$form_state,t('The directory %directory does not exist and could not be created.',array('%directory'=>$directory)));
$form_state->setErrorByName($form_element['#parents'][0],t('The directory %directory does not exist and could not be created.',array('%directory'=>$directory)));
$logger->error('The directory %directory does not exist and could not be created.',array('%directory'=>$directory));
// If the directory is not writable and cannot be made so.
form_set_error($form_element['#parents'][0],$form_state,t('The directory %directory exists but is not writable and could not be made writable.',array('%directory'=>$directory)));
$form_state->setErrorByName($form_element['#parents'][0],t('The directory %directory exists but is not writable and could not be made writable.',array('%directory'=>$directory)));
$logger->error('The directory %directory exists but is not writable and could not be made writable.',array('%directory'=>$directory));