Created
June 16, 2018 11:57
-
-
Save dikiyforester/171147dba23b1c3ee1b89b73522f818d to your computer and use it in GitHub Desktop.
The listing process step class to add explaining step at the beginning of the Claim Listing process.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MY_Step_Explain_Claim extends APP_Listing_Step { | |
/** | |
* Construct Listing step | |
* | |
* @param APP_Listing $listing Listing object to assign step with. | |
* @param string $step_id Step ID. | |
* @param array $args Optional. An array of arguments. | |
*/ | |
public function __construct( APP_Listing $listing, $step_id = 'explain', $args = array() ) { | |
$this->listing = $listing; | |
if ( empty( $args ) ) { | |
$args = array( | |
'priority' => 1, | |
'register_to' => array( | |
"{$this->listing->get_type()}-claim" => array( | |
//'before' => 'step_select_plan', | |
), | |
), | |
); | |
} | |
parent::__construct( $listing, $step_id, $args ); | |
} | |
/** | |
* Displays step | |
* | |
* @param APP_Order $order Order object. | |
* @param APP_Dynamic_Checkout $checkout Checkout object. | |
*/ | |
public function display( $order, $checkout ) { | |
$nonce_check = $checkout->get_checkout_type(); | |
$action_check = $this->step_id; | |
$form_id = esc_attr( "{$nonce_check}-{$action_check}" ); | |
$action_url = esc_attr( appthemes_get_step_url() ); | |
$nonce_fields = wp_nonce_field( $nonce_check, $action_check, true, false ); | |
$message = <<<EOT | |
<form id="$form_id" class="app-form" enctype="multipart/form-data" method="post" action="$action_url"> | |
$nonce_fields | |
<div class="section-head"> | |
<h1>How it works</h1> | |
</div> | |
<fieldset> | |
<div> | |
<p>Neque porro quisquam est qui dolorem rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit asp.</p> | |
<p>Rui nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquaear diff, and optional ceramic brake rotors can now all be orchestrated al fresco.</p> | |
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunsciunt. Neque porro quisquam est, qui dolorem ipsum.</p> | |
</div> | |
<div class="form-field"> | |
<button class="button primary" type="submit">Next Step</button> | |
</div> | |
</fieldset> | |
</form> | |
EOT; | |
appthemes_add_template_var( array( | |
'step_content' => $message, | |
) ); | |
parent::display( $order, $checkout ); | |
} | |
/** | |
* Processes Checkout Step | |
* | |
* @param APP_Order $order Order object. | |
* @param APP_Dynamic_Checkout $checkout Checkout object. | |
*/ | |
public function process( $order, $checkout ) { | |
if ( ! isset( $_POST[ $this->step_id ] ) ) { // Input var okay. | |
return; | |
} | |
check_admin_referer( $checkout->get_checkout_type(), $this->step_id ); | |
$this->finish_step(); | |
} | |
} | |
global $vantage; | |
new MY_Step_Explain_Claim( $vantage->{VA_LISTING_PTYPE} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This file should be loaded on
appthemes_init
action hook.