Adding custom fields to Carrier form
To add new fields to Carrier form you need to hook into the notification/carrier/registered action.
1
use BracketSpace\Notification\Defaults\Field\InputField;
2
​
3
add_action( 'notification/carrier/registered', function( $carrier ) {
4
​
5
if ( 'email' === $carrier->get_slug() ) {
6
return;
7
}
8
​
9
$carrier->add_form_field( new InputField( array(
10
'label' => __( 'Example Field' ),
11
'name' => 'example',
12
'resolvable' => true,
13
) ) );
14
​
15
} );
Copied!
All the field data will be automatically stored and available in $carrier->data property in send() method.
Last modified 4d ago
Copy link