function fonts_com_project_edit_form_submit in @font-your-face 7.2
Saves changes to project.
1 call to fonts_com_project_edit_form_submit()
- fonts_com_project_form_submit in modules/
fonts_com/ fonts_com.module - Sets active project, or creates a new project.
File
- modules/
fonts_com/ fonts_com.module, line 664
Code
function fonts_com_project_edit_form_submit($form, &$form_state) {
module_load_include('inc', 'fonts_com', 'api');
$values = $form_state['values'];
$save_needed = FALSE;
if (isset($values['project_id']) && $values['project_id'] != '*new*') {
$project = fonts_com_get_project_by_id($values['project_id']);
if ($project->ProjectName != $values['project_name']) {
$project->ProjectName = $values['project_name'];
$save_needed = TRUE;
}
// if
}
else {
$project = new StdClass();
$project->ProjectName = $values['project_name'];
$save_needed = TRUE;
}
// else
if (!$save_needed || fonts_com_save_project($project)) {
drupal_set_message(t('Project <i>@project</i> saved.', array(
'@project' => $project->ProjectName,
)));
if ($values['active']) {
variable_set('fonts_com_project', $project->ProjectKey);
fonts_com_import_from_project($project->ProjectKey);
fonts_com_enable_from_active_project();
}
else {
if ($values['active'] === 0 && $values['project'] == variable_get('fonts_com_project', '')) {
variable_set('fonts_com_project', '');
}
}
// else if
$new_domains = array();
foreach ($form_state['input']['domain'] as $domain) {
if (trim($domain) != '') {
$new_domains[] = trim($domain);
}
// if
}
// foreach
fonts_com_save_domains_in_project($project->ProjectKey, $new_domains);
drupal_goto('admin/config/user-interface/fontyourface/fonts_com/project');
}
// if
}