From 843a894ebbb4ec030f7eba0c1987a7725e3f5bf1 Mon Sep 17 00:00:00 2001 From: Mike Decker Date: Mon, 22 Apr 2024 13:07:02 -0700 Subject: [PATCH] cleanup code --- .../caw_profile_helper.module | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/modules/caw_profile_helper/caw_profile_helper.module b/modules/caw_profile_helper/caw_profile_helper.module index 3f44ea89..f4b2b9d1 100644 --- a/modules/caw_profile_helper/caw_profile_helper.module +++ b/modules/caw_profile_helper/caw_profile_helper.module @@ -20,33 +20,6 @@ use Drupal\views\Plugin\views\query\QueryPluginBase; use Drupal\views\ViewExecutable; use Drupal\Core\Cache\Cache; -function mikes() { - $field_name = 'caw_benefits_foobarbaz'; - $options = ['below' => 'caw_benefits_med_maternity_stay']; - $label = NULL; - /** @var \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay $view */ - $view = \Drupal::entityTypeManager() - ->getStorage('entity_view_display') - ->load('node.caw_benefits.default'); - foreach ($view->getSections() as $section) { - foreach ($section->getComponents() as $component) { - $component_config = $component->get('configuration'); - if (str_ends_with($component->getPluginId(), $options['below'])) { - $uuid = \Drupal::service('uuid')->generate(); - $new_config = $component_config; - $new_config['id'] = str_replace($options['below'], $field_name, $new_config['id']); - $new_config['label'] = $label?: $field_name; - $new_component = new \Drupal\layout_builder\SectionComponent($uuid, $component->getRegion(),$new_config); - $new_component->setWeight($component->getWeight() + 1); - - $section->insertAfterComponent($component->getUuid(), $new_component); - $view->save(); - return; - } - } - } -} - /** * Implements hook_paragraphs_behavior_info_alter(). */