function page_manager_page_form_basic_submit

Store the values from the basic settings form.

File

page_manager/plugins/tasks/page.admin.inc, line 596

Code

function page_manager_page_form_basic_submit(&$form, &$form_state) {
    $page =& $form_state['page']->subtask['subtask'];
    $cache =& $form_state['page'];
    // If this is a new thing, then we have to do a bunch of setup to create
    // the cache record with the right ID and some basic data that we could
    // not know until we asked the user some questions.
    if (!isset($page->pid) && !empty($form_state['creating'])) {
        // Update the data with our new name.
        $page->name = $form_state['values']['name'];
        $form_state['page']->task_name = page_manager_make_task_name($form_state['task_id'], $page->name);
        $cache->handler = $form_state['values']['handler'];
        $cache->subtask_id = $page->name;
        $plugin = page_manager_get_task_handler($cache->handler);
        // If they created and went back, there might be old, dead handlers
        // that are not going to be added.
        //
        // Remove them:
        $cache->handlers = array();
        $cache->handler_info = array();
        // Create a new handler.
        $handler = page_manager_new_task_handler($plugin);
        $title = !empty($form_state['values']['title']) ? $form_state['values']['title'] : $plugin['title'];
        page_manager_handler_add_to_page($cache, $handler, $title);
        // Figure out which forms to present them with.
        $cache->forms = array();
        // This one is always there.
        $cache->forms[] = 'basic';
        if (!empty($form_state['arguments'])) {
            $cache->forms[] = 'argument';
        }
        $features = $form_state['values']['features'];
        $cache->forms = array_merge($cache->forms, array_keys(array_filter($features['default'])));
        if (isset($features[$form_state['values']['handler']])) {
            $cache->forms = array_merge($cache->forms, array_keys(array_filter($features[$form_state['values']['handler']])));
        }
        if (isset($plugin['required forms'])) {
            $cache->forms = array_merge($cache->forms, array_keys($plugin['required forms']));
        }
    }
    $page->admin_title = $form_state['values']['admin_title'];
    $cache->subtask['admin title'] = check_plain($form_state['values']['admin_title']);
    $page->admin_description = $form_state['values']['admin_description'];
    $cache->subtask['admin description'] = filter_xss_admin($form_state['values']['admin_description']);
    if ($page->path != $form_state['values']['path']) {
        $page->path = $form_state['values']['path'];
        page_manager_page_recalculate_arguments($page);
        $cache->path_changed = TRUE;
    }
    $page->make_frontpage = !empty($form_state['values']['frontpage']);
    $page->conf['admin_paths'] = !empty($form_state['values']['admin_paths']);
}