Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function poetic_toolkit_admin_settings() {
- $viewport_setting_description = "Enable this to force the viewport to enable viewport 'width=device-width' and set the scale to 1.0. <strong>This MUST be enabled for other settings in this module to function.</strong>";
- $webapp_setting_description = "Enable this to allow for mobile devices to save the page as a bookmark and load into a webapp wrapper (for iOS and Android).";
- $form['poetic_toolkit_mobile_viewport_setting'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable Mobile Viewport'),
- '#description' => t($viewport_setting_description),
- '#default_value' => variable_get('poetic_toolkit_mobile_viewport_setting', TRUE),
- );
- $form['poetic_toolkit_enable_webapp_setting'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable Mobile Web App'),
- '#description' => t($webapp_setting_description),
- '#default_value' => variable_get('poetic_toolkit_enable_webapp_setting', FALSE),
- '#states' => array('visible' => array(':input[name="poetic_toolkit_mobile_viewport_setting"]' => array('checked' => TRUE),),),
- );
- array_unshift($form['#submit'], 'poetic_toolkit_admin_submit');
- return system_settings_form($form);
- }
- function poetic_toolkit_admin_submit($form, &$form_state) {
- // check if field A is checked
- if(!$form_state['values']['poetic_toolkit_mobile_viewport_setting']) {
- // if it is not then set field B value to 0
- $form_state['values']['poetic_toolkit_enable_webapp_setting'] = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement