function _hosting_server_preprocess_explode in Hosting 7.4
Same name and namespace in other branches
- 7.3 server/hosting_server.module \_hosting_server_preprocess_explode()
Add fields to table headers or rows.
In order to allow the our server list view to dynamically respond to the number of enabled services, we define the field as a comma-separated list in our field handler. Here we explode that text back into an array, and add it back to the table render array.
@see: hosting_server_handler_field_services::label() @see: hosting_server_handler_field_services::render()
1 call to _hosting_server_preprocess_explode()
- hosting_server_preprocess in server/
hosting_server.module - Implements hook_preprocess().
File
- server/
hosting_server.module, line 877
Code
function _hosting_server_preprocess_explode(&$element, $depth = 0) {
if ($depth) {
foreach ($element as $i => $sub_element) {
_hosting_server_preprocess_explode($sub_element, $depth - 1);
$element[$i] = $sub_element;
}
}
else {
$index = array_search('services', array_keys($element));
$services = explode(',', $element['services']);
array_splice($element, $index, 1, $services);
}
}