function varbase_core_form_features_export_form_alter in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 7.3
Implements hook_form_FORM_ID_alter().
We will remove all exportables that we don't want to save in features by mistake, this is to remove them from the UI only. If there was a need to remove the export totaly look at hook_features_export_alter.
File
- modules/
features/ varbase_core/ varbase_core.module, line 16
Code
function varbase_core_form_features_export_form_alter(&$form, &$form_state, $form_id) {
$component = array(
'variable' => '',
'defaultconfig' => 'strongarm__58__',
);
foreach ($component as $key => $prefix) {
// Disable strongarm variables that are only for the site
// @todo see what can we do with these variables and site_specific_confige feature
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'date_default_timezone']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'diff_theme']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'features_modules_changed']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'features_ignored_orphans']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'file_temporary_path']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'install_profile']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'install_profiles']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'site_mail']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'site_name']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'site_default_country']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'site_slogan']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'theme_default']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'update_notify_emails']);
// This is in the settings.php and should never be exposed or saved
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'drupal_private_key']);
// Disable not needed strongarm variables
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'array_filter']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'cron_key']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'cron_last']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'ctools_last_cron']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'context_block_rebuild_needed']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'cache_class_cache_ctools_css']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'css_js_query_string']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'date_api_version']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'date_db_tz_support']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'default_field_group']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'drupal_http_request_fails']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'email__active_tab']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'entity_cache_tables_created']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'entityreference_58_base-tables']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'features_codecache']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'features_semaphore']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'install_task']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'install_time']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'install_current_batch']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'javascript_parsed']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'maintenance_mode']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'menu_expanded']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'menu_masks']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'variable_module_list']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'node_cron_last']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'path_alias_whitelist']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'update_last_check']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'update_last_email_notification']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'update_notification_threshold']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'views_block_hashes']);
unset($form['export'][$key]['sources']['selected']['#options'][$prefix . 'views_defaults']);
// Remove common strongarm variables that we don't need to save
foreach ($form['export'][$key]['sources']['selected']['#options'] as $option => $value) {
switch (true) {
case strpos($option, 'additional_settings__active_tab_') !== FALSE:
case strpos($option, 'save_continue_') !== FALSE:
case strpos($option, '__active_tab') !== FALSE:
/* Memecache stores all cache info in variables table, this will impact the performance
* of the site.
*
* @todo check a soloution for memcache cache variables
* For more information see:
* https://www.drupal.org/node/2373811
* https://www.drupal.org/node/973436
*/
case strpos($option, 'cache_flush_cache') !== FALSE:
case strpos($option, 'cache_content_flush_') !== FALSE:
case strpos($option, 'cache_temporary_flush_') !== FALSE:
unset($form['export'][$key]['sources']['selected']['#options'][$option]);
break;
}
}
}
/* Remove Admin views from features they can't be saved through features
* and they cause a problem if they are saved
*/
unset($form['export']['views_view']['sources']['selected']['#options']['admin_views_file']);
unset($form['export']['views_view']['sources']['selected']['#options']['admin_views_node']);
unset($form['export']['views_view']['sources']['selected']['#options']['admin_views_taxonomy_term']);
unset($form['export']['views_view']['sources']['selected']['#options']['admin_views_user']);
}