| @@ -638,48 +638,43 @@ | ||
| 638 | 638 | |
| 639 | 639 | return $form; |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | - public function prepareMenuHtml(object $form, string $type): array | |
| 642 | + public function prepareMenuHtml(object $form, string $type): void | |
| 643 | 643 | { |
| 644 | 644 | $this->initSettings(); |
| 645 | 645 | |
| 646 | 646 | $sections = $this->getSectionTranslations(); |
| 647 | - $htmlMenu = []; | |
| 648 | 647 | foreach ($this->settings[$type] as $category => $options) { |
| 649 | - $categoryOptions = []; | |
| 648 | + $hasOptions = false; | |
| 649 | + | |
| 650 | 650 | foreach ($options as $key => $option) { |
| 651 | 651 | if (!empty($option['allowed_types']) && !in_array($form->type, $option['allowed_types'])) { |
| 652 | 652 | continue; |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | + if (!$hasOptions) { | |
| 656 | + $hasOptions = true; | |
| 657 | + echo '<h3 class="cell acym__forms__menu__title acym__title acym__title__tertiary">'.esc_html(acym_translation($sections[$category])).'</h3>'; | |
| 658 | + } | |
| 659 | + | |
| 655 | 660 | $id = 'form_'.$category.'_'.$key; |
| 656 | 661 | $name = 'form[settings]['.$category.']['.$key.']'; |
| 657 | 662 | $vModel = 'form.settings.'.$category.'.'.$key; |
| 658 | 663 | $value = $form->settings[$category][$key] ?? $option['default']; |
| 659 | 664 | |
| 660 | - $label = '<label class="cell" for="'.$id.'">'.acym_translation($option['label']); | |
| 665 | + echo '<div class="cell grid-x acym__forms__menu__options grid-margin-x acym_vcenter">'; | |
| 666 | + | |
| 667 | + echo '<label class="cell" for="'.esc_attr($id).'">'.esc_html(acym_translation($option['label'])); | |
| 661 | 668 | if (!empty($option['description'])) { |
| 662 | - ob_start(); | |
| 663 | 669 | acym_info(['textShownInTooltip' => $option['description']]); |
| 664 | - $label .= ob_get_clean(); | |
| 665 | 670 | } |
| 666 | - $label .= '</label>'; | |
| 671 | + echo '</label>'; | |
| 667 | 672 | |
| 668 | - ob_start(); | |
| 669 | 673 | include acym_getPartial('fields', $option['type']); |
| 670 | - $categoryOptions[$key] = $label.ob_get_clean(); | |
| 674 | + echo '</div>'; | |
| 671 | 675 | } |
| 672 | - | |
| 673 | - if (!empty($categoryOptions)) { | |
| 674 | - $htmlMenu[] = [ | |
| 675 | - 'title' => acym_translation($sections[$category]), | |
| 676 | - 'render' => $categoryOptions, | |
| 677 | - ]; | |
| 678 | - } | |
| 679 | 676 | } |
| 680 | - | |
| 681 | - return $htmlMenu; | |
| 682 | 677 | } |
| 683 | 678 | |
| 684 | 679 | public function renderForm(object $form, bool $edition = false, bool $isShortcode = false): string |
| 685 | 680 | { |