You are here

function _coder_settings_array in Coder 5.2

Same name and namespace in other branches
  1. 5 coder.module \_coder_settings_array()
  2. 6.2 coder.module \_coder_settings_array()
  3. 6 coder.module \_coder_settings_array()

Generate settings array for either modules or themes.

Parameters

$form_values: Form array passed to submit function (note: entries that are processed. are removed for efficiency's sake).

$type: String type to generate settings for, either 'module' or 'theme'.

Return value

Settings lookup array in form module/theme name => 1

2 calls to _coder_settings_array()
coder_page_form in ./coder.module
Implementation of hook_form().
coder_settings_form_submit in ./coder.module
Callback function for settings page in Drupal 5.

File

./coder.module, line 455
Developer Module that assists with code review and version upgrade that supports a plug-in extensible hook system so contributed modules can define additional review standards.

Code

function _coder_settings_array(&$form_values, $type) {
  $typekey = "coder_{$type}s-";
  $typelen = strlen($typekey);
  $systems = array();
  foreach ($form_values as $key => $value) {
    if (substr($key, 0, $typelen) == $typekey) {
      if ($value == 1) {
        $system = substr($key, $typelen);
        $systems[$system] = 1;
      }
      unset($form_values[$key]);
    }
  }
  return $systems;
}