New Conditional Logic Class
<?php
use YayMailAddonConditionalLogic\SingletonTrait;
use YayMailAddonConditionalLogic\Abstracts\BaseConditionalLogic;
/**
* New Conditional Logic
*/
class NewConditionalLogic extends YayMailAddonConditionalLogic\Abstracts\BaseConditionalLogic {
use SingletonTrait;
protected function __construct() {
parent::__construct(
'new_logic', // Unique key.
__( 'Conditional logic title', 'yaymail' ), // Title in UI
'single_select'
);
}
public function get_options() {
$options = [
[
'label' => 'Option 1',
'value' => 'option_1',
],
[
'label' => 'Option 2',
'value' => 'option_2',
]
];
return $options;
}
public function check_logic( $args ) {
// If this function return true -> Conditional logic is true then the element containing this logic will be displayed when sending mail.
$condition = $args['condition'];
$order = $args['order'];
$condition_value = $condition['value'];
return true;
}
}
Last updated
Was this helpful?