Skip to content
Snippets Groups Projects

chore: 3386077 Make module compatible with Drupal 10.

2 files
+ 8
4
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -265,11 +265,14 @@ class ExcelImporterForm extends FormBase {
*/
private function isValidTaxonomyReference($bundle, $field, $value) {
$definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions('node', $bundle);
$vid = $this->getVocabulary($bundle, $field);
$term = Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadByProperties(['name' => $value, 'vid' => $vid]);
$tid = $this->arrayKeyFirst($term);
if ($definitions[$field]->getSettings()['handler_settings']['auto_create']) {
if ($definitions[$field]->getSettings()['handler_settings']['auto_create'] && !empty($value)) {
return TRUE;
}
elseif ($this->arrayKeyFirst(taxonomy_term_load_multiple_by_name($value, $this->getVocabulary($bundle, $field)))) {
elseif ($tid) {
return TRUE;
}
@@ -347,7 +350,8 @@ class ExcelImporterForm extends FormBase {
if ($target_type == 'taxonomy_term') {
$vid = $this->getVocabulary($bundle, $field);
$tid = $this->arrayKeyFirst(taxonomy_term_load_multiple_by_name($value, $vid));
$term = Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadByProperties(['name' => $value, 'vid' => $vid]);
$tid = $this->arrayKeyFirst($term);
$canAutoCreate = $definitions[$field]->getSettings()['handler_settings']['auto_create'];
if ($canAutoCreate && empty($tid)) {
Loading