Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions oda.module
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,7 @@ function oda_form_alter(array &$form, FormStateInterface $form_state, string $fo
$form['#attached']['library'][] = 'webform/webform.element.select2';
$form['#attached']['library'][] = 'oda/oit_data_report_page_form';
// Group for access report TAC.
$form['oda_access_group'] = [
'#title' => t('Data Report Access Group'),
'#type' => 'details',
'#group' => 'advanced',
'#open' => 1,
'#weight' => 99,
];
$form['oda_access_group'] = _oda_access_group_details();
$form['field_oda_report_access']['#group'] = 'oda_access_group';
// Group for page sub-type extra fields.
$form['oda_terms'] = [
Expand Down Expand Up @@ -239,6 +233,11 @@ function oda_form_alter(array &$form, FormStateInterface $form_state, string $fo

// Set defaults on data page nodes for ODA type.
if ($form_id == "node_oda_page_form" || $form_id == "node_oda_page_edit_form") {

// Group for access report TAC.
$form['oda_access_group'] = _oda_access_group_details();
$form['field_oda_report_access']['#group'] = 'oda_access_group';

$advanced = [
'#type' => 'inline_template',
'#template' => '<details>
Expand Down Expand Up @@ -273,6 +272,22 @@ function oda_form_alter(array &$form, FormStateInterface $form_state, string $fo

}

/**
* Build shared form details for ODA access group.
*
* @return array<string, mixed>
* Access group details render array.
*/
function _oda_access_group_details(): array {
return [
'#title' => t('Data Report Access Group'),
'#type' => 'details',
'#group' => 'advanced',
'#open' => 1,
'#weight' => 99,
];
}

/**
* Set domain on content to match site domain.
*
Expand Down
Loading