diff --git a/docroot/modules/custom/va_gov_home/src/EventSubscriber/FormEventSubscriber.php b/docroot/modules/custom/va_gov_home/src/EventSubscriber/FormEventSubscriber.php index 3ec9e72d969..e9b5d1c23a3 100644 --- a/docroot/modules/custom/va_gov_home/src/EventSubscriber/FormEventSubscriber.php +++ b/docroot/modules/custom/va_gov_home/src/EventSubscriber/FormEventSubscriber.php @@ -35,12 +35,15 @@ public function __construct(UserPermsService $permsService) { * @param \Drupal\core_event_dispatcher\Event\Form\FormAlterEvent $event * The form event. */ - public function formAlter(FormAlterEvent $event) { + public function formAlter(FormAlterEvent $event): void { + $form = &$event->getForm(); if ($event->getFormId() === 'menu_link_content_home-page-hub-list_form') { - $form = &$event->getForm(); $admin = $this->permsService->hasAdminRole(TRUE); $this->hubMenuFormAlter($form, $admin); - }; + } + if ($event->getFormId() === 'menu_link_content_va-gov-footer_form' || $event->getFormId() === 'menu-link-content-footer-bottom-rail-form') { + $this->hideMenuLinkDescriptionField($form, $admin); + } } /** @@ -51,7 +54,7 @@ public function formAlter(FormAlterEvent $event) { * @param bool $admin * TRUE if current user is an admin. */ - public function hubMenuFormAlter(array &$form, bool $admin) { + public function hubMenuFormAlter(array &$form, bool $admin): void { $this->hubMenuHideAddtributes($form) ->hubMenuHideExpanded($form) ->hubMenuHideViewMode($form, $admin) @@ -122,6 +125,16 @@ public function hubMenuHideParentLink(array &$form, bool $admin): static { return $this; } + /** + * Hides the description field on certain menu link forms. + * + * @param array $form + * The form element array. + */ + public function hideMenuLinkDescriptionField(array &$form): void { + $form['description']['#access'] = FALSE; + } + /** * {@inheritdoc} */