modal_forms.admin.inc 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <?php
  2. /**
  3. * @file
  4. * Administrative page callbacks for the modal_forms module.
  5. */
  6. /**
  7. * General configuration form for controlling the modal_forms behaviour.
  8. */
  9. function modal_forms_admin_settings() {
  10. // Login settings.
  11. $form['modal_forms_login_settings'] = array(
  12. '#type' => 'fieldset',
  13. '#title' => t('Login links settings'),
  14. );
  15. $form['modal_forms_login_settings']['modal_forms_login'] = array(
  16. '#type' => 'checkbox',
  17. '#title' => t('Enable for login links'),
  18. '#default_value' => variable_get('modal_forms_login', 0),
  19. '#description' => t('Automatically activate Modal forms for links to user/login.'),
  20. );
  21. $form['modal_forms_login_settings']['modal_forms_login_links'] = array(
  22. '#type' => 'radios',
  23. '#title' => t('Display links'),
  24. '#options' => array(
  25. 0 => t('No links'),
  26. 1 => t('Show links'),
  27. 2 => t('Show links and open them in a modal'),
  28. ),
  29. '#default_value' => variable_get('modal_forms_login_links', 0),
  30. '#description' => t('Display the "Create new account" (if allowed) and "Request new password" links below the login form.'),
  31. '#states' => array(
  32. 'visible' => array(
  33. ':input[name="modal_forms_login"]' => array('checked' => TRUE),
  34. ),
  35. ),
  36. );
  37. // Register settings.
  38. $form['modal_forms_register_settings'] = array(
  39. '#type' => 'fieldset',
  40. '#title' => t('Register links settings'),
  41. );
  42. $form['modal_forms_register_settings']['modal_forms_register'] = array(
  43. '#type' => 'checkbox',
  44. '#title' => t('Enable for register new account links'),
  45. '#default_value' => variable_get('modal_forms_register', 0),
  46. '#description' => t('Automatically activate Modal forms for links to user/register.'),
  47. );
  48. // Password settings.
  49. $form['modal_forms_password_settings'] = array(
  50. '#type' => 'fieldset',
  51. '#title' => t('Password links settings'),
  52. );
  53. $form['modal_forms_password_settings']['modal_forms_password'] = array(
  54. '#type' => 'checkbox',
  55. '#title' => t('Enable for request new password links'),
  56. '#default_value' => variable_get('modal_forms_password', 0),
  57. '#description' => t('Automatically activate Modal forms for links to user/password.'),
  58. );
  59. // Comments settings.
  60. $form['modal_forms_comment_settings'] = array(
  61. '#type' => 'fieldset',
  62. '#title' => t('Comment links settings'),
  63. );
  64. $form['modal_forms_comment_settings']['modal_forms_comment'] = array(
  65. '#type' => 'checkbox',
  66. '#title' => t('Enable for comment links'),
  67. '#default_value' => variable_get('modal_forms_comment', 0),
  68. '#description' => t('Automatically activate Modal forms for links to comment.'),
  69. );
  70. // Contact settings.
  71. $form['modal_forms_contact_settings'] = array(
  72. '#type' => 'fieldset',
  73. '#title' => t('Contact links settings'),
  74. );
  75. $form['modal_forms_contact_settings']['modal_forms_contact'] = array(
  76. '#type' => 'checkbox',
  77. '#title' => t('Enable for contact links'),
  78. '#default_value' => variable_get('modal_forms_contact', 0),
  79. '#description' => t('Automatically activate Modal forms for links to contact.'),
  80. );
  81. // Styles and options settings.
  82. $form['modal_forms_custom_settings'] = array(
  83. '#type' => 'fieldset',
  84. '#title' => t('Styles and options'),
  85. '#collapsible' => TRUE,
  86. '#collapsed' => TRUE,
  87. );
  88. $form['modal_forms_custom_settings']['modal_forms_background_color'] = array(
  89. '#type' => 'textfield',
  90. '#title' => t('Background color'),
  91. '#default_value' => variable_get('modal_forms_background_color', '#000'),
  92. '#size' => 7,
  93. '#maxlength' => 7,
  94. '#required' => TRUE,
  95. '#description' => t('The color of the background behind the modal. Should be entered in html hex notation (eg #000).'),
  96. );
  97. $form['modal_forms_custom_settings']['modal_forms_opacity'] = array(
  98. '#type' => 'textfield',
  99. '#title' => t('Background opacity'),
  100. '#default_value' => variable_get('modal_forms_opacity', 0.85),
  101. '#size' => 3,
  102. '#maxlength' => 5,
  103. '#required' => TRUE,
  104. '#description' => t('The opacity of the background behind the modal. Should be entered as a decimal value (eg 0.85 = 85% opacity).'),
  105. );
  106. // Modal popup size settings
  107. $modal_types = array('fixed' => t('Fixed'), 'scale' => t('Scale'));
  108. // Popup Small
  109. $form['modal_forms_custom_settings']['modal_forms_popup_small'] = array(
  110. '#type' => 'fieldset',
  111. '#title' => t('Modal popup small'),
  112. '#collapsible' => TRUE,
  113. '#collapsed' => TRUE,
  114. );
  115. $form['modal_forms_custom_settings']['modal_forms_popup_small']['modal_forms_popup_small_type'] = array(
  116. '#type' => 'radios',
  117. '#title' => t('Type'),
  118. '#default_value' => variable_get('modal_forms_popup_small_type', 'fixed'),
  119. '#options' => $modal_types,
  120. '#description' => t('Fixed sizes should be entered in pixels. Scaled sizes should be entered as a decimal percentage of the screen region (eg 0.8 = 80% of screen width/height).'),
  121. );
  122. $form['modal_forms_custom_settings']['modal_forms_popup_small']['modal_forms_popup_small_width'] = array(
  123. '#type' => 'textfield',
  124. '#title' => t('Width'),
  125. '#default_value' => variable_get('modal_forms_popup_small_width', 300),
  126. '#size' => 3,
  127. '#maxlength' => 5,
  128. '#required' => TRUE,
  129. );
  130. $form['modal_forms_custom_settings']['modal_forms_popup_small']['modal_forms_popup_small_height'] = array(
  131. '#type' => 'textfield',
  132. '#title' => t('Height'),
  133. '#default_value' => variable_get('modal_forms_popup_small_height', 300),
  134. '#size' => 3,
  135. '#maxlength' => 5,
  136. '#required' => TRUE,
  137. );
  138. // Popup Medium
  139. $form['modal_forms_custom_settings']['modal_forms_popup_medium'] = array(
  140. '#type' => 'fieldset',
  141. '#title' => t('Modal popup medium'),
  142. '#collapsible' => TRUE,
  143. '#collapsed' => TRUE,
  144. );
  145. $form['modal_forms_custom_settings']['modal_forms_popup_medium']['modal_forms_popup_medium_type'] = array(
  146. '#type' => 'radios',
  147. '#title' => t('Type'),
  148. '#default_value' => variable_get('modal_forms_popup_medium_type', 'fixed'),
  149. '#options' => $modal_types,
  150. '#description' => t('Fixed sizes should be entered in pixels. Scaled sizes should be entered as a decimal percentage of the screen region (eg 0.8 = 80% of screen width/height).'),
  151. );
  152. $form['modal_forms_custom_settings']['modal_forms_popup_medium']['modal_forms_popup_medium_width'] = array(
  153. '#type' => 'textfield',
  154. '#title' => t('Width'),
  155. '#default_value' => variable_get('modal_forms_popup_medium_width', 550),
  156. '#size' => 3,
  157. '#maxlength' => 5,
  158. '#required' => TRUE,
  159. );
  160. $form['modal_forms_custom_settings']['modal_forms_popup_medium']['modal_forms_popup_medium_height'] = array(
  161. '#type' => 'textfield',
  162. '#title' => t('Height'),
  163. '#default_value' => variable_get('modal_forms_popup_medium_height', 450),
  164. '#size' => 3,
  165. '#maxlength' => 5,
  166. '#required' => TRUE,
  167. );
  168. // Popup Large
  169. $form['modal_forms_custom_settings']['modal_forms_popup_large'] = array(
  170. '#type' => 'fieldset',
  171. '#title' => t('Modal popup large'),
  172. '#collapsible' => TRUE,
  173. '#collapsed' => TRUE,
  174. );
  175. $form['modal_forms_custom_settings']['modal_forms_popup_large']['modal_forms_popup_large_type'] = array(
  176. '#type' => 'radios',
  177. '#title' => t('Type'),
  178. '#default_value' => variable_get('modal_forms_popup_large_type', 'scale'),
  179. '#options' => $modal_types,
  180. '#description' => t('Fixed sizes should be entered in pixels. Scaled sizes should be entered as a decimal percentage of the screen region (eg 0.8 = 80% of screen width/height).'),
  181. );
  182. $form['modal_forms_custom_settings']['modal_forms_popup_large']['modal_forms_popup_large_width'] = array(
  183. '#type' => 'textfield',
  184. '#title' => t('Width'),
  185. '#default_value' => variable_get('modal_forms_popup_large_width', 0.8),
  186. '#size' => 3,
  187. '#maxlength' => 5,
  188. '#required' => TRUE,
  189. );
  190. $form['modal_forms_custom_settings']['modal_forms_popup_large']['modal_forms_popup_large_height'] = array(
  191. '#type' => 'textfield',
  192. '#title' => t('Height'),
  193. '#default_value' => variable_get('modal_forms_popup_large_height', 0.8),
  194. '#size' => 3,
  195. '#maxlength' => 5,
  196. '#required' => TRUE,
  197. );
  198. // Page activation/deactivation settings.
  199. $form['modal_forms_advanced_settings'] = array(
  200. '#type' => 'fieldset',
  201. '#title' => t('Page activation settings'),
  202. '#collapsible' => TRUE,
  203. '#collapsed' => TRUE,
  204. );
  205. $form['modal_forms_advanced_settings']['modal_forms_visibility'] = array(
  206. '#type' => 'radios',
  207. '#title' => t('Show Modal forms on specific pages'),
  208. '#options' => array(0 => t('All pages except those listed'), 1 => t('Only the listed pages')),
  209. '#default_value' => variable_get('modal_forms_visibility', 0),
  210. );
  211. $form['modal_forms_advanced_settings']['modal_forms_pages'] = array(
  212. '#type' => 'textarea',
  213. '#title' => '<span class="element-invisible">' . t('Pages') . '</span>',
  214. '#default_value' => variable_get('modal_forms_pages', "admin*\nimagebrowser*\nimg_assist*\nimce*\nnode/add/*\nnode/*/edit\nprint/*\nprintpdf/*\nsystem/ajax\nsystem/ajax/*"),
  215. '#description' => t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')),
  216. );
  217. return system_settings_form($form);
  218. }