Verified Commit 55904628 authored by alexpott's avatar alexpott
Browse files

Issue #3242538 by danflanagan8, mounir_abid, cilefen, DigitalFrontiersMedia,...

Issue #3242538 by danflanagan8, mounir_abid, cilefen, DigitalFrontiersMedia, super_romeo, smustgrave: Term creation fail with php 8 when override_selector = TRUE

(cherry picked from commit 86c4193f)
parent 52319318
......@@ -63,15 +63,19 @@ public function form(array $form, FormStateInterface $form_state) {
$options[$item->tid] = str_repeat('-', $item->depth) . $item->name;
}
}
$form['relations']['parent'] = [
'#type' => 'select',
'#title' => $this->t('Parent terms'),
'#options' => $options,
'#default_value' => $parent,
'#multiple' => TRUE,
];
}
else {
$options = ['<' . $this->t('root') . '>'];
$parent = [0];
}
$form['relations']['parent'] = [
'#type' => 'select',
'#title' => $this->t('Parent terms'),
'#options' => $options,
'#default_value' => $parent,
'#multiple' => TRUE,
];
$form['relations']['weight'] = [
'#type' => 'textfield',
......
......@@ -432,6 +432,31 @@ public function testTermInterface() {
$this->assertSession()->pageTextNotContains('Save and go to list');
}
/**
* Test UI with override_selector TRUE.
*/
public function testTermSaveOverrideSelector() {
$this->config('taxonomy.settings')->set('override_selector', TRUE)->save();
// Create a Term.
$edit = [
'name[0][value]' => $this->randomMachineName(12),
'description[0][value]' => $this->randomMachineName(100),
];
// Create the term to edit.
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add');
$this->submitForm($edit, 'Save');
$terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadByProperties([
'name' => $edit['name[0][value]'],
]);
$term = reset($terms);
$this->assertNotNull($term, 'Term found in database.');
// The term appears on the vocab list page.
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
$this->assertSession()->pageTextContains($term->getName());
}
/**
* Save, edit and delete a term using the user interface.
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment