Gets the current container for a given form and submission.
Description
See also
Parameters
- $form
-
(awsmug\Torro_Forms\DB_Objects\Forms\Form) (Required) Form object.
- $submission
-
(awsmug\Torro_Forms\DB_Objects\Submissions\Submission|null) (Optional) Submission object, or null if none available.
Default value: null
Return
(awsmug\Torro_Forms\DB_Objects\Containers\Container|null) Container object, or null on failure.
Source
File: src/db-objects/forms/form-frontend-output-handler.php
protected function get_current_container( $form, $submission = null ) { if ( $submission ) { return $submission->get_current_container(); } $container_collection = $form->get_containers( array( 'number' => 1, 'orderby' => array( 'sort' => 'ASC', ), 'no_found_rows' => true, ) ); if ( 1 > count( $container_collection ) ) { return null; } return $container_collection[0]; }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |