public function ThemeKeyRuleChainForm::submitForm in ThemeKey 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 ConfigFormBase::submitForm
File
- src/
Form/ ThemeKeyRuleChainForm.php, line 106
Class
- ThemeKeyRuleChainForm
- Provides a form for administering the ThemeKey rule chain.
Namespace
Drupal\themekey\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$chain = array();
foreach (Element::children($form['table']) as $ruleId) {
$parent = $form_state
->getValue(array(
'table',
$ruleId,
'parent',
));
$chain[$ruleId] = array(
'weight' => $form_state
->getValue(array(
'table',
$ruleId,
'weight',
)),
'parent' => $parent ?: NULL,
'enabled' => $form_state
->getValue(array(
'table',
$ruleId,
'enabled',
)),
);
}
$ruleChainManager = $this
->getRuleChainManager();
$ruleChainManager
->setChain($chain);
drupal_set_message($this
->t('The rule chain has been saved.'));
}