English (United Kingdom)

public function getForm() : array

Returns the configuration fields of the action.


Description

This method is used to define the list of fields used by the configuration of the action.

The array to return should look like the following JSON representation.

{
    "param_1": {
        "type": "text",
        "value": "abc",
        "label": "Text Field"
    },
    "param_2": {
        "type": "select",
        "value": "one",
        "label": "Dropdown",
        "options": {
            "one": "One",
            "two": "Two",
            "three": "Three"
        }
    }
}

 Further details about all the supported fields can be found HERE.


 Return Value

Array. An associative array containing the configuration form of the conditional text action.


Example

The example below explains how to support the fields mentioned in the article used to describe the apply method.

/**
 * @inheritDoc
 */
public function getForm()
{
    return [
        'sendermail' => [
            'type'  => 'email',
            'label' => __('Sender e-mail', 'myplugin'),
            'value' => $this->options->get('sendermail'),
        ],
        'sendername' => [
            'type'  => 'text',
            'label' => __('Sender name', 'myplugin'),
            'value' => $this->options->get('sendername'),
        ],
        'replyto' => [
            'type'  => 'email',
            'label' => __('Reply-to e-mail', 'myplugin'),
            'value' => $this->options->get('replyto'),
        ],
    ];
}
Last Update: 2023-12-21
Helpful?