Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-9496: Remove dependency to helfi_tpr_config from hdbt_admin_tools #734

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
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
18 changes: 0 additions & 18 deletions modules/hdbt_admin_tools/hdbt_admin_tools.module
Original file line number Diff line number Diff line change
Expand Up @@ -147,24 +147,6 @@ function hdbt_admin_tools_form_node_form_alter(&$form, &$form_state, $form_id):
$form['actions']['submit']['#submit'][] = 'hdbt_admin_tools_node_form_submit_callback';
}

/**
* Implements hook_form_FORM_ID_alter().
*/
function hdbt_admin_tools_form_tpr_unit_form_alter(&$form, &$form_state, $form_id): void {
$form['field_phone_label']['#states'] = [
'visible' => [
':input[name="field_phone_with_contacts[value]"]' => ['checked' => TRUE],
],
];

// Required state must the widget rather than the form element.
$form['field_phone_label']['widget'][0]['value']['#states'] = [
'required' => [
':input[name="field_phone_with_contacts[value]"]' => ['checked' => TRUE],
],
];
}

/**
* Form submit callback for node forms.
*
Expand Down
18 changes: 18 additions & 0 deletions modules/helfi_tpr_config/helfi_tpr_config.module
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,24 @@ function template_preprocess_tpr_service_lower_content(array &$variables) : void
}
}

/**
* Implements hook_form_FORM_ID_alter().
*/
function helfi_tpr_config_form_tpr_unit_form_alter(&$form, &$form_state, $form_id): void {
$form['field_phone_label']['#states'] = [
'visible' => [
':input[name="field_phone_with_contacts[value]"]' => ['checked' => TRUE],
],
];

// Required state must the widget rather than the form element.
$form['field_phone_label']['widget'][0]['value']['#states'] = [
'required' => [
':input[name="field_phone_with_contacts[value]"]' => ['checked' => TRUE],
],
];
}

/**
* Implements hook_form_FORM_ID_alter().
*/
Expand Down