diff --git a/modules/tide_landing_page/tide_landing_page.module b/modules/tide_landing_page/tide_landing_page.module index 107649ee..772b8106 100644 --- a/modules/tide_landing_page/tide_landing_page.module +++ b/modules/tide_landing_page/tide_landing_page.module @@ -6,6 +6,8 @@ */ use Drupal\Core\Cache\Cache; +use \Drupal\Core\Ajax\AjaxResponse; +use \Drupal\Core\Ajax\InvokeCommand; use Drupal\Core\Field\WidgetBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; @@ -44,7 +46,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(); } } @@ -373,17 +375,17 @@ 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(); +function tide_landing_page_change_the_value($form, FormStateInterface $form_state): \Drupal\Core\Ajax\AjaxResponse { + $response = new AjaxResponse(); $value = $form_state->getValue('_header_style_options'); - if ($value === 'fullwidth'){ - return $response->addCommand(new \Drupal\Core\Ajax\InvokeCommand( + if ($value === 'fullwidth') { + return $response->addCommand(new InvokeCommand( '#edit-field-landing-page-hero-theme', 'val', ['dark'] )); } - return $response->addCommand(new \Drupal\Core\Ajax\InvokeCommand( + return $response->addCommand(new InvokeCommand( '#edit-field-landing-page-hero-theme', 'val', ['light'] @@ -425,7 +427,7 @@ function _tide_landing_page_form_node_form_process(array $form, FormStateInterfa 'cta' => t('Call to action banner'), ], '#ajax' => [ - 'callback' => 'change_the_value', + 'callback' => 'tide_landing_page_change_the_value', ], ]; $form['field_landing_page_hero_image']['widget']['field_landing_page_hero_theme']['#states']['disabled'] = [