Guest Support for Joomla! - Documentation

With the Guest Support Pro extension, you have the flexibility to create numerous custom fields. By using the 'Plugin Field' form field type, you can generate input field programmatically using a plugin event described below. This method retains the label, column size, and field order from the form, allowing you to leverage form designer features effortlessly.

Example Use Case:

Imagine you have few products and wish to dynamically display them with a select box, enabling users to choose the product they need support for. Alternatively, you may want to present logged-in customers with their orders as a select box, allowing them to select the order they require support for. This feature seamlessly facilitates such functionalities.

Step 01: Create Form Field:

  1. Create a custom form field by following How to add custom form fields?
  2. Choose the Field TypePlugin Field. Refer to the screenshot below for reference:



  3. From the Placeholder for Plugin input box, copy the value. For example: {guest_support_field_product}. The Placeholder for Plugin should be unique for every field with type Plugin Field. Refer to the screenshot below for reference:

Step 02: Generate Input Field with Plugin Event:

Guest Support utilizes the Joomla! plugin system with the group guestsupport. Therefore, the initial step is to create a standard Joomla! plugin and install it using Joomla!'s extension installer. You can learn how to create a Joomla! plugin by referring to the official Joomla! documentation available here: https://docs.joomla.org/Portal:Plugin_Development

To define the plugin group do as follows on the xml file:

<extension type="plugin" group="guestsupport" method="upgrade">

Using the API:

onGuestsupportBeforeDisplayForm(Event $event)

/**
 * Triggered before displaying form fields.
 * Applies to both ticket submission and ticket reply forms.
 */
public function onGuestsupportBeforeDisplayForm(Event $event)
{
    // Modify the form fields here.
}

This method will trigger before displaying your form fields. The method applies to both the ticket submission and ticket reply forms. The $event object includes the following parameters:

  1. 'context': The value is 'guestsupport.ticketform' on the ticket submission form and 'guestsupport.replyform' on the reply form.
  2. 'form_id': This parameter includes the Form ID.
  3. 'data': This parameter contains the raw HTML data of the form fields. You can utilize functions like str_replace() to replace the form field's placeholder with an actual input field.

To use the method, include the following namespace in the plugin's PHP file:

use Joomla\Event\Event;

Here is a basic example demonstrating how to replace the placeholder with an actual input field:

public function onGuestsupportBeforeDisplayForm(Event $event)
{
  $data = $event->getArgument('data');
  $input = '<input type="text" name="order_no" placeholder="Enter your order no.">';
  $data = str_replace( "{guest_support_field_order_no}", $input, $data );
  $event->setArgument('data', $data);
}