Italian (Italy)
Knowledge Base  >  Vik Appointments  >  Hook  >  Export  >  Build Parameters Form

apply_filters_ref_array( 'vikappointments_build_parameters_form_{$driver}', bool $status, array &$form, mixed $handler )

Fires while loading the form fields of the specified export driver.


Description

Trigger hook to allow the plugins to manipulate the parameters form used by the export driver. 

The dynamic portion of the hook name, $driver, refers to the name of the export driver calling the hook. This means that, for example, the CSV export driver will trigger an hook called vikappointments_build_parameters_form_csv.


Parameters

$status

(bool)  True on success, false otherwise.

&$form

(array)  An associative array containing all the form fields of the export driver.

$handler

(VAPOrderExportDriver)  The instance used to export the records.


Example 

/**
 * Trigger hook to allow the plugins to manipulate the parameters
 * form used by this export driver.
 *
 * @param  boolean  $status   True on success, false otherwise.
 * @param  array    &$form    A configuration array.
 * @param  mixed    $handler  The export driver instance.
 */
add_filter('vikappointments_build_parameters_form_csv', function($status, &$form, $handler)
{
    // overwrite type of "delimiter" and "enclosure" fields, by changing
    // them from "select" to "text" fields
    $form['delimiter']['type'] = 'text';
    $form['enclosure']['type'] = 'text';

    // add a new field
    $form['foo'] = [
        'type'    => 'select',
        'label'   => __('Foo', 'my-custom-plugin'),
        'default' => 1,
        'options' => [
            1 => __('Yes'),
            0 => __('No'),
        ],
    ];

    return $status;
});

Changelog

Version Description
1.2 Introduced.
Ultimo aggiornamento: 2021-08-06
Utile?