Prepares links for the request.
Description
See also
Parameters
- $submission
-
(awsmug\Torro_Forms\DB_Objects\Submissions\Submission) (Required) Submission object.
Return
(array) Links for the given submission.
Source
File: src/db-objects/submissions/rest-submissions-controller.php
protected function prepare_links( $submission ) { $links = parent::prepare_links( $submission ); if ( ! empty( $submission->user_id ) ) { $links['author'] = array( 'href' => rest_url( 'wp/v2/users/' . $submission->user_id ), 'embeddable' => true, ); } if ( ! empty( $submission->form_id ) ) { $links['form'] = array( 'href' => rest_url( trailingslashit( sprintf( '%s/%s', $this->namespace, 'forms' ) ) . $submission->form_id ), ); } $primary_property = $this->manager->get_primary_property(); $links['submission_values'] = array( 'href' => add_query_arg( array( 'submission_id' => $submission->$primary_property, 'per_page' => 50, ), rest_url( sprintf( '%s/%s', $this->namespace, 'submission_values' ) ) ), 'embeddable' => true, ); return $links; }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |