public function ReorderFieldsForm::submitForm in Feed Import 8
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- src/
Form/ ReorderFieldsForm.php, line 74 - Contains \Drupal\feed_import\Form\ReorderFieldsForm
Class
Namespace
Drupal\feed_import\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$v = $form_state
->getValues();
if (empty($v['table']) || !$this->feed) {
return;
}
$fields = array();
uasort($v['table'], array(
'Drupal\\Component\\Utility\\SortArray',
'sortByWeightElement',
));
foreach ($v['table'] as $name => $value) {
$fields[$name] = $this->feed->settings['fields'][$name];
}
$this->feed->settings['fields'] = $fields;
if (FeedImport::saveFeed($this->feed)) {
drupal_set_message(t('Feed saved'));
}
}