public function DomainListBuilder::submitForm in Domain Access 8
Overrides the parent method to prevent saving bad data.
@link https://www.drupal.org/project/domain/issues/2925798 @link https://www.drupal.org/project/domain/issues/2925629
Overrides DraggableListBuilder::submitForm
File
- domain/
src/ DomainListBuilder.php, line 280
Class
- DomainListBuilder
- User interface for the domain overview screen.
Namespace
Drupal\domainCode
public function submitForm(array &$form, FormStateInterface $form_state) {
foreach ($form_state
->getValue($this->entitiesKey) as $id => $value) {
if (isset($this->entities[$id]) && $this->entities[$id]
->get($this->weightKey) != $value['weight']) {
// Reset weight properly.
$this->entities[$id]
->set($this->weightKey, $value['weight']);
// Do not allow accidental hostname rewrites.
$this->entities[$id]
->set('hostname', $this->entities[$id]
->getCanonical());
$this->entities[$id]
->save();
}
}
}