function messaging_template_extract_group in Messaging 6.4
Extract a group of templates from an array of them (including all fallbacks for selected)
Parameters
$filter: Array of template names
File
- messaging_template/
messaging_template.module, line 306 - Drupal Messaging Framework - Messaging template
Code
function messaging_template_extract_group($filter, $templates) {
$filter = is_array($filter) ? $filter : array(
$filter,
);
$selected = array();
foreach ($templates as $key => &$template) {
if (in_array($key, $filter)) {
$selected[$key] = $template;
// Add fallbacks for selected templates too
while (!empty($template['fallback']) && ($fallback = $template['fallback']) && !isset($selected[$fallback])) {
$template = $templates[$fallback];
$selected[$fallback] = $template;
}
}
}
return $selected;
}