Explore advanced field customization

Explore advanced field customization 

In WooPrice Calculator it’s possible to render every single component of a field by reading the “$this->view[‘fields’]” object. Properties are as follow: 

<?php
  

  echo $this->view[‘fields‘][aws_price_calc_n‘][‘id’];
 

  echo $this->view[‘fields‘][aws_price_calc_n‘][‘label_id‘];
 

  echo $this->view[‘fields‘][aws_price_calc_n‘][‘label_name‘];
 

  echo $this->view[‘fields‘][aws_price_calc_n‘][‘field_id‘];
 

  echo $this->view[‘fields‘][aws_price_calc_n‘][‘type’];
 

  echo $this->view[‘fields‘][aws_price_calc_n‘][‘class’];
 

  echo $this->view[‘fields‘][aws_price_calc_n‘][‘html’];
 

  echo $this->view[‘fields‘][aws_price_calc_n‘][‘value’];
 

?> 

Where: 

  • aws_price_calc_n: Replace it with the name of the field, which you would like to get the properties of. 
  • id: Numeric ID of the field 
  • label_id: Unique ID of the field label 
  • field_id: Alphanumeric ID of the field 
  • type: Type of field 
  • class: CSS class applied to the field 
  • html: HTML rendering of the field 
  • value: Value of the field 

Here is an example of how to render every field component (Every field must exist): 

<?php 

/* 

 * THEME_NAME: Example of Advanced Field Customization 

 */ 

?> 

 

<div class=”awspc-product-form”> 

        <!–Field start–> 

        <div data-id=”<?php echo $this->view[‘data‘][‘aws_price_calc_1’][‘elementId‘]; ?>” class=”form-group awspc-field-widget”> 

                <div class=”awspc-field <?php echo $this->view[‘data‘][‘aws_price_calc_1’][‘class’]; ?>”> 

                <?php echo $this->view[‘fields‘][‘aws_price_calc_1’][‘html’]; ?> 

                <label for=”<?php echo $this->view[‘data‘][‘aws_price_calc_1’][‘elementId‘]; ?>_field”> 

                        <?php echo $this->view[‘fields‘][‘aws_price_calc_1’][‘label_name‘]; ?> 

                </label> 

                </div> 

                <div class=”awspc-field-error”></div> 

        </div> 

        <!–Field end–> 

        <!–Field start–> 

        <div data-id=”<?php echo $this->view[‘data‘][‘aws_price_calc_2’][‘elementId‘]; ?>” class=”form-group awspc-field-widget”> 

                <div class=”awspc-field <?php echo $this->view[‘data‘][‘aws_price_calc_2’][‘class’]; ?>”> 

                <?php echo $this->view[‘fields‘][‘aws_price_calc_2’][‘html’]; ?> 

                <label for=”<?php echo $this->view[‘data‘][‘aws_price_calc_2’][‘elementId‘]; ?>_field”> 

                        <?php echo $this->view[‘fields‘][‘aws_price_calc_2’][‘label_name‘]; ?> 

                </label> 

                </div> 

                <div class=”awspc-field-error”></div> 

        </div> 

        <!–Field end–> 

        <!–Field start–> 

        <div data-id=”<?php echo $this->view[‘data‘][‘aws_price_calc_3’][‘elementId‘]; ?>” class=”form-group awspc-field-widget”> 

                <div class=”awspc-field <?php echo $this->view[‘data‘][‘aws_price_calc_3’][‘class’]; ?>”> 

                <?php echo $this->view[‘fields‘][‘aws_price_calc_3’][‘html’]; ?> 

                <label for=”<?php echo $this->view[‘data‘][‘aws_price_calc_3’][‘elementId‘]; ?>_field”> 

                        <?php echo $this->view[‘fields‘][‘aws_price_calc_3’][‘label_name‘]; ?> 

                </label> 

                </div> 

                <div class=”awspc-field-error”></div> 

        </div> 

        <!–Field end–> 

</div>