Form_Settings_Page::render_form_content( string $current_tab_id, string $current_subtab_id )

Renders the settings page form content.

Description

Parameters

$current_tab_id

(string) (Required) Identifier of the current tab.

$current_subtab_id

(string) (Required) Identifier of the current sub-tab.

Source

File: src/db-objects/forms/form-settings-page.php

	protected function render_form_content( $current_tab_id, $current_subtab_id ) {
		if ( $this->manager->get_prefix() . 'general_settings' === $current_tab_id ) {
			?>
			<div class="welcome-to-torro">
				<h3><?php _e( 'Welcome to Torro Forms!', 'torro-forms' ); ?></h3>
				<p><?php _e( 'You want to build forms in an easy way? Torro Forms will help you do it quickly, yet with tons of options.', 'torro-forms' ); ?></p>
			</div>
			<?php
		}

		$subtabs = wp_list_filter( $this->subtabs, array(
			'tab' => $current_tab_id,
		) );
		if ( empty( $subtabs ) ) {
			return;
		}

		$use_subtabs = count( $subtabs ) > 1;

		?>
		<div class="torro-form-content <?php echo $use_subtabs ? 'tabbed' : 'no-tabs'; ?>">

			<?php if ( $use_subtabs ) : ?>
				<div class="torro-subtab-wrapper" role="tablist">
					<?php foreach ( $subtabs as $subtab_id => $subtab_args ) :
						$url = add_query_arg( array(
							'tab'    => $current_tab_id,
							'subtab' => $subtab_id,
						), $this->url );

						?>
						<a id="<?php echo esc_attr( 'torro-subtab-label-' . $subtab_id ); ?>" class="torro-subtab" href="<?php echo esc_url( $url ); ?>" aria-controls="<?php echo esc_attr( 'torro-subtab-' . $subtab_id ); ?>" aria-selected="<?php echo $subtab_id === $current_subtab_id ? 'true' : 'false'; ?>" role="tab">
							<?php echo $subtab_args['title']; ?>
						</a>
					<?php endforeach; ?>
				</div>
			<?php else : ?>
				<div class="screen-reader-text"><?php echo $subtabs[ $current_subtab_id ]['title']; ?></div>
			<?php endif; ?>

			<?php foreach ( $subtabs as $subtab_id => $subtab_args ) :
				$atts = $use_subtabs ? ' aria-labelledby="' . esc_attr( 'torro-subtab-label-' . $subtab_id ) . '" aria-hidden="' . ( $subtab_id === $current_subtab_id ? 'false' : 'true' ) . '" role="tabpanel"' : '';

				?>
				<div id="<?php echo esc_attr( 'torro-subtab-' . $subtab_id ); ?>" class="torro-subtab-panel"<?php echo $atts; ?>>

					<?php if ( ! empty( $subtab_args['description'] ) ) : ?>
						<p class="description"><?php echo $subtab_args['description']; ?></p>
					<?php endif; ?>

					<?php $this->do_settings_sections( $current_tab_id . '_' . $subtab_id ); ?>

				</div>
			<?php endforeach; ?>

		</div>
		<?php
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.