Please Activate Coupon Module First
'. __('Activate Coupon Module', 'fluentformpro') . '' . __('After creating your first coupon please reload this page.', 'fluentformpro') . '
'
];
}
return $disables;
});
}
function getComponent()
{
return array(
'index' => 6,
'element' => $this->key,
'attributes' => array(
'type' => 'text',
'name' => 'payment-coupon',
'value' => '',
'id' => '',
'class' => '',
'placeholder' => '',
'data-is_coupon' => 'yes'
),
'settings' => array(
'container_class' => '',
'is_payment_field' => 'yes',
'label' => __('Coupon', 'fluentformpro'),
'admin_field_label' => '',
'label_placement' => '',
'suffix_label' => __('Apply Coupon', 'fluentformpro'),
'help_message' => '',
'validation_rules' => array(
'required' => array(
'value' => false,
'global' => true,
'message' => Helper::getGlobalDefaultMessage('required'),
'global_message' => Helper::getGlobalDefaultMessage('required'),
)
),
'conditional_logics' => array()
),
'editor_options' => array(
'title' => __('Coupon', 'fluentformpro'),
'icon_class' => 'el-icon-postcard',
'template' => 'inputText'
),
);
}
public function getGeneralEditorElements()
{
return [
'label',
'label_placement',
'admin_field_label',
'placeholder',
'suffix_label'
];
}
public function getAdvancedEditorElements()
{
return [
'container_class',
'class',
'help_message',
'name',
'conditional_logics',
'calculation_settings'
];
}
public function render($data, $form)
{
$data['attributes']['class'] .= ' ff_coupon_item';
$data['settings']['container_class'] .= ' ff_coupon_wrapper';
return (new Text())->compile($data, $form);
}
public function addCouponsToSubmission($value, $field, $submissionData)
{
if(isset($submissionData['__ff_all_applied_coupons'])) {
$allCoupons = $submissionData['__ff_all_applied_coupons'];
$allCoupons = \json_decode($allCoupons, true);
if($allCoupons) {
$value = implode(', ', $allCoupons);
}
}
return $value;
}
}