function _chosen_devide_array_by_plugin in Chosen 7.3
Implementation of _chosen_devide_array_by_plugin().
Helperfunction to seperate fields by plugin_name.
Parameters
$flat_array: Array containing a flat array. The keys needs to contain the plugin_name in front of the original key. It will be stripped of in this process.
Return value
$values Array containing the flat elements, sorted by plugin_name without the plugin_name in front of the key anymore.
2 calls to _chosen_devide_array_by_plugin()
- chosen_admin_settings_form_submit in ./
chosen.module - Implementation of chosen_admin_settings_form_submit().
- chosen_field_widget_settings_form in ./
chosen.module - Implementation of chosen_field_widget_settings_form().
File
- ./
chosen.module, line 96 - General functions and hook implementations.
Code
function _chosen_devide_array_by_plugin($flat_array) {
$values = array();
foreach ($flat_array as $key => $value) {
foreach (ctools_get_plugins('chosen', 'library') as $plugin_name => $plugin_settings) {
if (substr($key, 0, strlen($plugin_name)) == $plugin_name) {
$field_name = substr($key, strlen($plugin_name) + 1);
$values[$plugin_name][$field_name] = $value;
}
}
}
return $values;
}