function gathercontent_pages_import_form in GatherContent 7.2
Form constructor for mapping fields.
1 string reference to 'gathercontent_pages_import_form'
- gathercontent_menu in ./
gathercontent.module - Implements hook_menu().
File
- includes/
pages_import.inc, line 10 - Contains page field mapping form.
Code
function gathercontent_pages_import_form($form, &$form_state) {
gathercontent_check_step('pages_import');
$obj = gathercontent_get_obj();
$obj
->getStates();
$obj
->getPages(TRUE);
$obj
->getPostTypes();
$obj
->pageOverwriteDropdown();
$obj
->mapToDropdown();
$obj
->filtersDropdown();
$obj
->parentDropdown();
$cur_settings = variable_get('gathercontent_saved_settings', '');
variable_set('gathercontent_media_files', array());
if (!is_array($cur_settings)) {
$cur_settings = array();
}
$obj->data['saved_settings'] = $obj
->val($cur_settings, variable_get('gathercontent_project_id'), array());
drupal_add_js(array(
'gathercontent' => array(
'ajaxurl' => url('admin/config/content/gathercontent/import_page'),
'media' => url('admin/config/content/gathercontent/media'),
'finished' => url('admin/config/content/gathercontent/finished'),
'error_message' => t('There was a problem connecting. Please try again later'),
'hierarchical_post_types' => $obj->hierarchical,
),
), 'setting');
$path = drupal_get_path('module', 'gathercontent');
drupal_add_js($path . '/js/jquery-ui-1.10.3.custom.min.js');
drupal_add_js($path . '/js/pages_import.js');
$form['modals'] = array(
'#markup' => '
<div class="gc_overlay"></div>
<div class="gc_container gc_modal gc_importing_modal">
<h2>' . t('Importing pages and text content...') . '</h2>
<label>' . t('Page:') . ' <span id="gc_page_title"></span><img src="' . file_create_url($path . '/images/ajax-loader-grey.gif') . '" alt="" /></label>
<div id="current_page" class="progress">
<div class="bar" style="width:0%"></div>
</div>
</div>
<div class="gc_container gc_modal gc_repeating_modal">
<h2>' . t('Repeating configuration...') . '</h2>
<img src="' . file_create_url($path . '/images/ajax_loader_blue.gif') . '" alt="" />
</div>',
);
$form['page_header'] = array(
'#prefix' => '<div class="gc_page_header gc_cf">',
'#suffix' => '</div>',
);
$form['page_header']['title'] = array(
'#markup' => '<h2>' . check_plain(t('Choose pages to import')) . '</h2>',
);
$form['page_header']['account_link'] = array(
'#type' => 'link',
'#title' => t('Account settings'),
'#href' => 'admin/config/content/gathercontent/login',
);
$form['page_options'] = array();
$form['page_options']['select_pages'] = array(
'#type' => 'link',
'#href' => 'admin/config/content/gathercontent/pages',
'#title' => t('Select different pages'),
'#prefix' => '<div class="gc_search_pages gc_cf"><div class="gc_left">',
'#suffix' => '</div>',
);
$form['page_options']['submit'] = array(
'#type' => 'submit',
'#value' => t('Import selected pages'),
'#prefix' => '<div class="gc_right">',
'#suffix' => '</div></div>',
);
$form['page_list'] = array();
$form['pages'] = array();
$form['settings'] = array();
$form = $obj
->generateFormSettings($form, $obj->pages, -1, TRUE);
$form['page_options_footer'] = array();
$form['page_options_footer']['select_pages'] = array(
'#type' => 'link',
'#href' => 'admin/config/content/gathercontent/pages',
'#title' => t('Select different pages'),
'#prefix' => '<div class="gc_search_pages gc_search_bottom gc_cf"><div class="gc_left">',
'#suffix' => '</div>',
);
$form['page_options_footer']['submit'] = array(
'#type' => 'submit',
'#value' => t('Import selected pages'),
'#prefix' => '<div class="gc_right">',
'#suffix' => '</div></div>',
);
return $form;
}