You are here

function _coder_review_settings_array in Coder 7.2

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

Generates a settings array for either modules or themes names.

Parameters

array $form_state: The form state array that is passed to a submit function, passed by reference. Note: As entries are processed, they are removed for the sake of efficiency.

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

Return value

array An associative array with keys of module/theme name and a value of 1.

See also

coder_review_page_form()

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.admin.inc
Form submission handler for coder_review_admin_settings().

File

coder_review/coder_review.module, line 515
Developer module to assist with coder reviews and API upgrade suggestions.

Code

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