function flag_import_form_submit in Flag 7.3
Same name and namespace in other branches
- 6.2 includes/flag.export.inc \flag_import_form_submit()
- 7.2 includes/flag.export.inc \flag_import_form_submit()
Submit handler; Import a flag.
File
- includes/
flag.export.inc, line 146 - Import/Export functionality provided by Flag module.
Code
function flag_import_form_submit($form, &$form_state) {
module_load_include('inc', 'flag', 'includes/flag.admin');
// Build up values for the cache clear.
$entity_types = array();
$new = FALSE;
foreach ($form_state['flags'] as $flag) {
$flag
->save();
if (!empty($flag->status)) {
$flag
->enable();
}
if ($flag->is_new) {
drupal_set_message(t('Flag @name has been imported.', array(
'@name' => $flag->name,
)));
$new = TRUE;
}
else {
drupal_set_message(t('Flag @name has been updated.', array(
'@name' => $flag->name,
)));
}
$entity_types[] = $flag->entity_type;
}
_flag_clear_cache($entity_types, $new);
$form_state['redirect'] = FLAG_ADMIN_PATH;
}