function fb_instant_articles_api_module_activation in Facebook Instant Articles 7
Same name and namespace in other branches
- 7.2 modules/fb_instant_articles_api/includes/admin.inc \fb_instant_articles_api_module_activation()
Generates Module Activation section of this module's settings form
1 call to fb_instant_articles_api_module_activation()
- fb_instant_articles_api_settings in modules/
fb_instant_articles_api/ includes/ admin.inc - Form constructor for Facebook Instant Articles API settings form.
File
- modules/
fb_instant_articles_api/ includes/ admin.inc, line 27 - Settings for Facebook Instant Articles API module.
Code
function fb_instant_articles_api_module_activation($form) {
// If the person is coming back to edit FB app settings, drop them back
// into the correct state
if (array_key_exists('edit', $_GET)) {
$edit_state = $_GET['edit'];
}
else {
$edit_state = '';
}
// Grab the current module settings from the database to determine where
// the person is in the configuration state
$fb_app_id = variable_get('fb_instant_articles_api_app_id', '');
$fb_app_secret = variable_get('fb_instant_articles_api_app_secret', '');
$fb_access_token = variable_get('fb_instant_articles_api_access_token', '');
$fb_page_id = variable_get('fb_instant_articles_page_id', '');
// If the App ID or App Secret haven't been configured for the module yet,
// drop the person into the initial state
if ($fb_app_id == '' || $fb_app_secret == '' || $edit_state == 'fb_app_settings') {
$form = fb_instant_articles_api_module_activation_fb_app_settings($form);
}
elseif ($fb_access_token == '') {
// If we don't have the access token yet, have the person connect their
// Facebook account next
$form = fb_instant_articles_api_module_activation_connect_fb_account($form);
}
elseif ($fb_page_id == '' || $edit_state == 'fb_page') {
// If we have access token but not selected page ID, have the person
// select the page next
$form = fb_instant_articles_api_module_activation_select_fb_page($form);
}
else {
// Everything's been configured, so let's provide the summary view
$form = fb_instant_articles_api_module_activation_summary($form);
}
return $form;
}