public static function EntityViewDisplayAlterer::multistepSubmit in Smart Title 8
Multi step submit callback for saving the temporary Smart Title config.
Parameters
array $form: The renderable array of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The form state object.
File
- src/
EntityViewDisplayAlterer.php, line 271
Class
- EntityViewDisplayAlterer
- Entity view display form alterer class for Smart Title.
Namespace
Drupal\smart_titleCode
public static function multistepSubmit(array $form, FormStateInterface $form_state) {
$trigger = $form_state
->getTriggeringElement();
$field_values = $form_state
->getValue('fields', [
'smart_title' => [
'settings_edit_form' => [],
],
]);
if ($trigger['#op'] === 'update' && !empty($field_values['smart_title']['settings_edit_form'])) {
$settings_to_save = !empty($field_values['smart_title']['settings_edit_form']['settings']) ? $field_values['smart_title']['settings_edit_form']['settings'] : [];
if (isset($settings_to_save['smart_title__classes'])) {
$settings_to_save['smart_title__classes'] = array_values(array_filter(explode(' ', $settings_to_save['smart_title__classes'])));
}
$form_state
->set('smart_title_tempvalues', $settings_to_save);
}
}