function gathercontent_media_form in GatherContent 7.2
Form constructor for displaying media import dialog.
1 string reference to 'gathercontent_media_form'
- gathercontent_menu in ./
gathercontent.module - Implements hook_menu().
File
- includes/
media.inc, line 10 - Page for importing media via AJAX.
Code
function gathercontent_media_form($form, &$form_state) {
gathercontent_check_step('media');
drupal_add_js(array(
'gathercontent' => array(
'ajaxurl' => url('admin/config/content/gathercontent/download_media'),
'redirecturl' => url('admin/config/content/gathercontent/finished'),
'error_message' => t('There was a problem connecting. Please try again later'),
),
), 'setting');
$path = drupal_get_path('module', 'gathercontent');
drupal_add_js($path . '/js/media.js');
$obj = gathercontent_get_obj();
$media = variable_get('gathercontent_media_files');
if (!(is_array($media) && isset($media['total_files']) && $media['total_files'] > 0)) {
drupal_goto('admin/config/content/gathercontent/finished');
}
unset($media['total_files']);
$post_id = key($media);
extract($obj
->getPageTitleArray($post_id));
$form['header'] = array(
'#markup' => '<h2>' . t('Importing files') . '</h2>',
);
$form['message'] = array(
'#prefix' => '<div class="alert alert-success">',
'#markup' => t('<strong>Heads up!</strong> This process can take a while, it depends on how many files you have attached to your pages. Just think how much time you\'re saving.'),
'#suffix' => '</div>',
);
$form['current_page']['label'] = array(
'#prefix' => '<label>',
'#suffix' => '</label>',
'#markup' => t('Page:') . ' <span id="gc_page_title" title="' . $original_title . '">' . $page_title . '</span><img src="' . file_create_url($path . '/images/ajax-loader-grey.gif') . '" alt="" />',
);
$form['current_page']['progress_bar'] = array(
'#markup' => '<div id="current_page" class="progress"><div class="bar" style="width:0%"></div></div>',
);
$form['overall']['label'] = array(
'#prefix' => '<label>',
'#suffix' => '</label>',
'#markup' => t('Overall Progress'),
);
$form['overall']['progress_bar'] = array(
'#markup' => '<div id="overall_files" class="progress"><div class="bar" style="width:0%"></div></div>',
);
$form['cancel_link'] = array(
'#prefix' => '<div class="gc_center">',
'#type' => 'link',
'#href' => 'admin/config/content/gathercontent/pages_import',
'#title' => t('Cancel'),
'#suffix' => '</div>',
);
return $form;
}