Returns the current container for the submission.
Description
See also
Return
(awsmug\Torro_Forms\DB_Objects\Containers\Container|null) Current container, or null on failure.
Source
File: src/db-objects/submissions/submission.php
public function get_current_container() { $container_id = (int) $this->__get( 'current_container_id' ); if ( ! empty( $container_id ) ) { $container = $this->manager->get_parent_manager( 'forms' )->get_child_manager( 'containers' )->get( $container_id ); } else { $form = $this->get_form(); if ( ! $form ) { return null; } $container_collection = $form->get_containers( array( 'number' => 1, 'orderby' => array( 'sort' => 'ASC', ), 'no_found_rows' => true, ) ); if ( 1 > count( $container_collection ) ) { return null; } $container = $container_collection[0]; $this->set_current_container( $container ); } return $container; }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |