getAsSections() as $section) { if ( $section->getId() === 'sidebar' ) { $sidebar[] = $section; } else { $main[] = $section; } } if ( empty($sidebar) ) { parent::renderStructure($structure); return; } //Render the main column. echo '
'; foreach ($main as $section) { $this->renderSection($section); } echo '
'; //Render the sidebar. echo '
'; $this->fullWidthGroupsEnabled = true; foreach ($sidebar as $section) { $this->renderSection($section); } $this->fullWidthGroupsEnabled = false; echo '
'; echo '
'; } public function renderSection($section) { echo HtmlHelper::tag('div', ['class' => 'ame-form-section ame-form-box']); $title = $section->getTitle(); if ( !empty($title) ) { echo '
'; echo '

'; $this->renderSectionTitleContent($section); echo '

'; } $description = $section->getDescription(); if ( !empty($description) ) { //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML intentionally allowed. echo "\n", '

', $description, '

'; } echo '
'; $this->renderSectionChildren($section); echo "
\n"; echo ''; } /** * @param \YahnisElsts\AdminMenuEditor\Customizable\Controls\ControlGroup $group * @return void */ protected function renderControlGroup($group) { $id = $group->getId(); $groupClasses = array_merge(['ame-form-box-group'], $group->getClasses()); echo HtmlHelper::tag( 'div', [ 'class' => $groupClasses, 'id' => !empty($id) ? $id : null, ] ); if ( !$this->fullWidthGroupsEnabled ) { echo '
'; $this->renderGroupTitleContent($group); echo '
'; } $contentClasses = ['ame-form-box-group-content']; if ( $this->fullWidthGroupsEnabled ) { $contentClasses[] = 'ame-form-box-full-width-content'; } echo HtmlHelper::tag('div', ['class' => $contentClasses]); $this->renderGroupChildren($group); echo ''; echo ''; } public function enqueueDependencies($containerSelector = '') { static $done = false; if ( $done ) { return; } $done = true; parent::enqueueDependencies($containerSelector); wp_enqueue_style( 'ame-boxy-form-renderer', plugins_url('assets/form-box.css', AME_CUSTOMIZABLE_BASE_FILE), array(), '20220609-2' ); } }