Currently we use conditionals in flickr.admin.inc to detect if a submodule is enabled to offer its settings, like:

  if (module_exists('flickr_block')) {
    $form['block_settings'] = array(
      '#type' => 'fieldset',
      ......

It would be better to move the form code to the corresponding sub-module itself in a file flickr_block.admin.inc inside a hook. In this case function flickr_block_form_flickr_admin_settings_alter(&$form, &$form_state).

We used the same method already effectively in #2387445: Add styling options in the configuration.

Comments

lolandese’s picture

Status: Active » Needs review
StatusFileSize
new22.12 KB

We ran into two issues to solve:

Q: How can we also move form validation to a sub-module?
A: http://befused.com/drupal/form-validation

Q: Should we declare .inc files in the .info file or with module_load_include() to put in the .module file of the sub-module?
A: https://www.drupal.org/node/1762288#comment-6749026

lolandese’s picture

Status: Needs review » Fixed

Straightforward enough to commit safely.

  • lolandese committed 0efaeb2 on 7.x-1.x
    Issue #2398929 by lolandese: Move sub-module configuration form code out...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.