function icon_bundle_overview_form_submit in Icon API 8
Same name and namespace in other branches
- 7 includes/admin.inc \icon_bundle_overview_form_submit()
Submit callback for 'icon_bundle_overview_form'.
File
Code
function icon_bundle_overview_form_submit($form, $form_state) {
$view_path_alias = $form_state['values']['icon_api_view_path_alias'];
if ($form['global']['icon_api_view_path_alias']['#default_value'] !== $view_path_alias) {
\Drupal::configFactory()
->getEditable('icon.settings')
->set('icon_api_view_path_alias', $view_path_alias)
->save();
if (!empty($view_path_alias)) {
drupal_set_message(t('The view path alias, "%url", has been created for users with the %permission permission.', array(
'%permission' => 'view icon',
'%url' => base_path() . $view_path_alias,
)));
}
else {
drupal_set_message(t('The view path alias is disabled. Icons are now only viewable in the administrative area.'));
}
menu_rebuild();
}
if (isset($form_state['values']['icon_api_apache_suppress_warning'])) {
\Drupal::configFactory()
->getEditable('icon.settings')
->set('icon_api_apache_suppress_warning', $form_state['values']['icon_api_apache_suppress_warning'])
->save();
// Remove message just set by building the form again.
unset($_SESSION['messages']['warning']);
}
$bundles = icon_bundles();
$saved_bundles = $form_state['values']['bundles'];
foreach ($bundles as $name => $bundle) {
if (!isset($saved_bundles[$name]['status'])) {
continue;
}
$status = $saved_bundles[$name]['status'];
if ($status !== $bundle['status']) {
if ($status) {
icon_bundle_enable($bundle);
}
else {
icon_bundle_disable($bundle);
}
}
}
}