Translate from state values into a nested array strucutre.

Paramètres

array $form_state_values: From state values; from $form_state['values'].

Return value

array Nested array strucutre, each index is a row in the db.

1 call to advagg_critical_css_get_rows_from_form()
advagg_critical_css_admin_settings_form_submit dans advagg_critical_css/advagg_critical_css.admin.inc
Submit callback, process the advagg_critical_css form.

Fichier

advagg_critical_css/advagg_critical_css.admin.inc, line 332

Code

function advagg_critical_css_get_rows_from_form(array $form_state_values) {
    $items = array();
    $counter = 0;
    foreach ($form_state_values as $key => $values) {
        // Get the index from the start of the form name.
        $matches = array();
        // 1_type turns into $counter = 1 and $key = type.
        preg_match('/^(\\d)_(.*)/', $key, $matches);
        if (!empty($matches)) {
            $counter = $matches[1];
            $key = $matches[2];
        }
        $items[$counter][$key] = $values;
    }
    return $items;
}