You are here

function _coder_review_settings_array in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_review/coder_review.module \_coder_review_settings_array()

Generate settings array for either modules or themes.

Parameters

$form_state: 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_review_settings_array()
coder_review_page_form in coder_review/coder_review.module
Implements hook_form().
coder_review_settings_form_submit in coder_review/coder_review.module
Callback function for settings page.

File

coder_review/coder_review.module, line 649

Code

function _coder_review_settings_array(&$form_state, $type) {
  $typekey = "coder_{$type}s-";
  $typelen = drupal_strlen($typekey);
  $systems = array();
  foreach ($form_state['storage'] as $key => $value) {
    if (drupal_substr($key, 0, $typelen) == $typekey) {
      if ($value == 1) {
        $system = drupal_substr($key, $typelen);
        $systems[$system] = 1;
      }
      unset($form_state['storage'][$key]);
      unset($form_state['values'][$key]);
    }
  }
  return $systems;
}