Aforms Form Builder For Price Calculator Cost Estimation Shortcode

Below, you’ll find a detailed guide on how to add the Aforms Form Builder For Price Calculator Cost Estimation Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Aforms Form Builder For Price Calculator Cost Estimation Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Aforms Form Builder For Price Calculator Cost Estimation Plugin and the shortcodes it provides:

Plugin Icon
AForms — Form Builder for Price Calculator & Cost Estimation

"AForms — Form Builder for Price Calculator & Cost Estimation is a powerful WordPress plugin. It aids in creating intuitive, customized forms for accurate price calculations and cost estimations."

★★★★☆ (8) Active Installs: 3000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [aforms-form]

Aforms Form Builder For Price Calculator Cost Estimation [aforms-form] Shortcode

The ‘aforms-form’ shortcode is a powerful tool used in the aforms-form-builder-for-price-calculator-cost-estimation plugin. It allows for the dynamic creation of forms based on the attributes specified. This shortcode takes in ‘path’ as an attribute, which is then used to match the corresponding shortcode and its arguments. It creates an input object from the attributes and a new ‘Payload’ instance. These are then passed to a function call. The function call results in a new payload, which is used to create an instance of ‘AForms\Shell\HtmlResponder’. This instance is then used to generate the final HTML output of the shortcode, based on the specified template and payload. The output is returned, ready for display.

Shortcode: [aforms-form]

Parameters

Here is a list of all possible aforms-form shortcode parameters and attributes:

Based on the given code, the shortcode has only one parameter:

  • path – determines the path to match with the available shortcodes

Examples and Usage

Basic Example – The shortcode ‘aforms-form’ is utilized to display a form on your webpage. The ‘path’ attribute is used to specify the path of the form you want to display.

[aforms-form path="contact_form"/]

Advanced Examples

1. Utilizing the shortcode to display a form by referencing a specific path. If the path is not found, it will return an error.

[aforms-form path="custom_path"/]

2. You can also use multiple parameters with the ‘aforms-form’ shortcode. In this example, we are passing two different paths to display two different forms.

[aforms-form path="contact_form" path2="feedback_form"/]

Please note that these examples are for illustrative purposes only. Replace ‘contact_form’, ‘custom_path’, and ‘feedback_form’ with the actual paths of your forms.

PHP Function Code

In case you have difficulties debugging what causing issues with [aforms-form] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('aforms-form', array($this->plugin, 'shortcode'));

Shortcode PHP function:

function shortcode($atts, $content, $name) 
    {
        if (isset($atts['path'])) {
            $path = $atts['path'];
            unset($atts['path']);
        } else {
            $path = null;
        }
        list($shortcode, $args) = $this->match($path, $this->shortcodes[$name]);
        $pointer = $shortcode->pointer;
        $input = (object)$atts;
        $payload = new Payload();
        $payload->setInput($input);
        $args[] = $input;
        $args[] = $payload;

        $payload = $this->call($pointer, $args);

        $r = $this->container->newInstance('AForms\Shell\HtmlResponder');
        $r->setEcho(false);
        $out = $r($shortcode->template, $payload);
        return $out;
    }

Code file location:

aforms-form-builder-for-price-calculator-cost-estimation/aforms-form-builder-for-price-calculator-cost-estimation/aforms.php

Conclusion

Now that you’ve learned how to embed the Aforms Form Builder For Price Calculator Cost Estimation Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *