Submission_Edit_Page::get_sections()

Returns the available edit sections.

Description

Return

(array) Associative array of <code>$section_slug => $section_args</code> pairs.

Source

File: src/db-objects/submissions/submission-edit-page.php

	protected function get_sections() {
		$sections = array(
			'associated_data'     => array(
				'tab'   => 'general',
				'title' => _x( 'Associated Data', 'submission edit page section', 'torro-forms' ),
			),
			'identification_data' => array(
				'tab'   => 'general',
				'title' => _x( 'Identification Data', 'submission edit page section', 'torro-forms' ),
			),
		);

		$primary_property = $this->model_manager->get_primary_property();

		$id = isset( $_REQUEST[ $primary_property ] ) ? absint( $_REQUEST[ $primary_property ] ) : null;

		if ( $id ) {
			$submission = $this->model_manager->get( $id );

			if ( $submission ) {
				$form = $this->model_manager->get_parent_manager( 'forms' )->get( $submission->form_id );

				if ( $form ) {
					foreach ( $form->get_containers() as $container ) {
						$sections[ 'container_' . $container->id ] = array(
							'tab'   => 'form_input',
							'title' => $container->label,
						);
					}
				}
			}
		}

		return $sections;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.