1 layout.flexible.inc layout_flexible_template_configure_form_submit($form, &$form_state)

Submit handler that saves the configured flexible template.

See also

layout_flexible_template_configure_form()

File

core/modules/layout/layout.flexible.inc, line 216
Provides configurable (flexible) layout templates.

Code

function layout_flexible_template_configure_form_submit($form, &$form_state) {
  // Load from tempstore rather than using $form_state, in the event a row
  // has been removed in an AJAX request.
  $flexible_template = layout_flexible_tempstore_load($form_state['flexible_template_name']);
  $positions = array();

  if (!empty($form_state['values']['row_positions'])) {
    $rows = array_filter(explode(',', $form_state['values']['row_positions']));
    foreach ($rows as $position) {
      if (isset($flexible_template->rows[$position])) {
        $positions[$position] = $flexible_template->rows[$position];
      }
    }
  }

  $flexible_template->rows = $positions;
  $flexible_template->save();

  tempstore_clear('layout.flexible', $form_state['flexible_template_name']);

  backdrop_set_message(t('Layout template "@title" saved.', array('@title' => $flexible_template->title)));
}