LLMS_Shortcode_Checkout::setup_plan_and_form_atts( int $plan_id, array $atts )
Setup attributes for plan and form information.
Parameters Parameters
- $plan_id
-
(int) (Required) LLMS_Access_Plan post id.
- $atts
-
(array) (Required) Existing attributes.
Return Return
(array) Modified attributes array.
Source Source
File: includes/shortcodes/class.llms.shortcode.checkout.php
protected static function setup_plan_and_form_atts( $plan_id, $atts ) {
$plan = new LLMS_Access_Plan( $plan_id );
$atts['plan'] = $plan;
$atts['product'] = $plan->get_product();
$atts['is_free'] = $plan->has_free_checkout();
$atts['form_location'] = 'checkout';
$atts['form_title'] = llms_get_form_title( $atts['form_location'], array( 'plan' => $plan ) );
$atts['form_fields'] = self::clean_form_fields( llms_get_form_html( $atts['form_location'], array( 'plan' => $plan ) ) );
// Add 'redirect' URL hidden field to be used on purchase completion.
$plan_redirection_url = $plan->get_redirection_url( false );
if ( $plan_redirection_url ) {
$atts['form_fields'] .= ( new LLMS_Form_Field(
array(
'id' => 'llms-redirect',
'name' => 'redirect',
'type' => 'hidden',
'value' => $plan_redirection_url,
'data_store_key' => false,
)
) )->get_html();
}
return $atts;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.0.0 | Add 'redirect' hidden field to be used on purchase completion. |
| 5.1.0 | Properly detect empty form fields when the html is only composed of blanks and empty paragraphs. |
| 5.0.0 | Introduced. |