Form submission handler.
array $form: An associative array containing the structure of the form.
array $form_state: An associative array containing the current state of the form.
Overrides FormInterface::submitForm
public function submitForm(array &$form, array &$form_state) {
$format = array();
$format['name'] = String::checkPlain($form_state['values']['date_format_name']);
$format['pattern'][$this->patternType] = trim($form_state['values']['date_format_pattern']);
$format['locales'] = !empty($form_state['values']['date_langcode']) ? $form_state['values']['date_langcode'] : array();
// Formats created in the UI are not locked.
$format['locked'] = 0;
system_date_format_save($form_state['values']['date_format_id'], $format);
if (!empty($form_state['values']['date_format_id'])) {
drupal_set_message(t('Custom date format updated.'));
}
else {
drupal_set_message(t('Custom date format added.'));
}
$form_state['redirect'] = 'admin/config/regional/date-time/formats';
}