Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-gao committed Nov 18, 2024
1 parent ab1735a commit 4d1de87
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion modules/tide_landing_page/tide_landing_page.module
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function tide_landing_page_entity_bundle_create($entity_type_id, $bundle) {
$editorial_workflow = Workflow::load('editorial');
if ($editorial_workflow) {
$editorial_workflow->getTypePlugin()
->addEntityTypeAndBundle('node', 'landing_page');
->addEntityTypeAndBundle('node', 'landing_page');
$editorial_workflow->save();
}
}
Expand Down Expand Up @@ -373,6 +373,23 @@ function tide_landing_page_field_widget_single_element_paragraphs_form_alter(&$e
}
}

function change_the_value($form, FormStateInterface $form_state): \Drupal\Core\Ajax\AjaxResponse {
$response = new \Drupal\Core\Ajax\AjaxResponse();
$value = $form_state->getValue('_header_style_options');
if ($value === 'fullwidth'){
return $response->addCommand(new \Drupal\Core\Ajax\InvokeCommand(
'#edit-field-landing-page-hero-theme',
'val',
['dark']
));
}
return $response->addCommand(new \Drupal\Core\Ajax\InvokeCommand(
'#edit-field-landing-page-hero-theme',
'val',
['light']
));
}

/**
* Node form #process callback.
*
Expand Down Expand Up @@ -407,6 +424,16 @@ function _tide_landing_page_form_node_form_process(array $form, FormStateInterfa
'corner' => t('Corner graphics'),
'cta' => t('Call to action banner'),
],
'#ajax' => [
'callback' => 'change_the_value',
],
];
$form['field_landing_page_hero_image']['widget']['field_landing_page_hero_theme']['#states']['disabled'] = [
':input[name="_header_style_options"]' => [
['value' => 'default'],
['value' => 'fullwidth'],
['value' => 'cta'],
],
];

$form['field_graphical_image']['#states']['visible'] = [
Expand Down

0 comments on commit 4d1de87

Please sign in to comment.