form = wpforms()->form->get( $form_id ); $this->form_data = $this->form ? wpforms_decode( $this->form->post_content ) : false; // Bootstrap. $this->init(); // Load panel specific enqueues. add_action( 'admin_enqueue_scripts', array( $this, 'enqueues' ), 15 ); // Primary panel button. add_action( 'wpforms_builder_panel_buttons', array( $this, 'button' ), $this->order, 2 ); // Output. add_action( 'wpforms_builder_panels', array( $this, 'panel_output' ), $this->order, 2 ); } /** * All systems go. Used by children. * * @since 1.0.0 */ public function init() { } /** * Enqueue assets for the builder. Used by children. * * @since 1.0.0 */ public function enqueues() { } /** * Primary panel button in the left panel navigation. * * @since 1.0.0 * * @param mixed $form * @param string $view */ public function button( $form, $view ) { $active = $view === $this->slug ? 'active' : ''; ?> slug ? 'active' : ''; $wrap = $this->sidebar ? 'wpforms-panel-sidebar-content' : 'wpforms-panel-full-content'; printf( '
', $active, esc_attr( $this->slug ) ); printf( '
%s
', $this->name ); printf( '
', $wrap ); if ( true === $this->sidebar ) { echo '
'; do_action( 'wpforms_builder_before_panel_sidebar', $this->form, $this->slug ); $this->panel_sidebar(); do_action( 'wpforms_builder_after_panel_sidebar', $this->form, $this->slug ); echo '
'; } echo '
'; echo '
'; do_action( 'wpforms_builder_before_panel_content', $this->form, $this->slug ); $this->panel_content(); do_action( 'wpforms_builder_after_panel_content', $this->form, $this->slug ); echo '
'; echo '
'; echo '
'; echo '
'; } /** * Output the panel's sidebar if we have one. * * @since 1.0.0 */ public function panel_sidebar() { } /** * Output panel sidebar sections. * * @since 1.0.0 * * @param string $name * @param string $slug * @param string $icon */ public function panel_sidebar_section( $name, $slug, $icon = '' ) { $class = ''; $class .= $slug === 'default' ? ' default' : ''; $class .= ! empty( $icon ) ? ' icon' : ''; echo ''; if ( ! empty( $icon ) ) { echo ''; } echo esc_html( $name ); echo ''; echo ''; } /** * Output the panel's primary content. * * @since 1.0.0 */ public function panel_content() { } }