function template_preprocess_date_recur_settings_frequency_table in Recurring Dates Field 3.1.x
Same name and namespace in other branches
- 8.2 date_recur.module \template_preprocess_date_recur_settings_frequency_table()
- 3.x date_recur.module \template_preprocess_date_recur_settings_frequency_table()
- 3.0.x date_recur.module \template_preprocess_date_recur_settings_frequency_table()
Template preprocessor for 'date_recur_settings_frequency_table'.
Parameters
array $variables: An associative array containing:
- element: An associative array containing a Form API structure to be rendered as a table.
File
- ./
date_recur.module, line 68
Code
function template_preprocess_date_recur_settings_frequency_table(array &$variables) : void {
$partTitles = [];
// Transfer elements to 'table' key so they can be iterated on without
// clashing with '#' elements.
$variables['table'] = [];
foreach (Element::children($variables['element']) as $key) {
$variables['table'][$key] = $variables['element'][$key];
$row =& $variables['table'][$key];
foreach (Element::children($row['parts']) as $rowKey) {
$row['parts']['parts'][$rowKey] = $row['parts'][$rowKey];
unset($row['parts'][$rowKey]);
foreach ($row['parts']['parts'] as $part) {
$partTitles[] = $part['#title'];
}
}
unset($variables['element'][$key]);
}
$variables['all_parts'] = array_unique($partTitles);
}