Created
October 28, 2019 02:49
-
-
Save ideadude/0479e90879aa35580d6870345ba93114 to your computer and use it in GitHub Desktop.
Example of one RH field depending on another.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This code should be placed into context of adding RH fields | |
// like this: https://www.paidmembershipspro.com/documentation/register-helper-documentation/code-examples/ | |
//define the fields | |
$fields = array(); | |
$fields[] = new PMProRH_Field( | |
'budget', // input name, will also be used as meta key | |
'select', // type of field | |
array( | |
'options' => array( // <option> elements for select field | |
'' => '', // blank option - cannot be selected if this field is required | |
'lessthan2000' => '< $2,000', // <option value="lessthan2000">< $2,000</option> | |
'2000to5000' => '$2,000-$5,000', // <option value="2000to5000">$2,000-$5,000</option> | |
'5000to10000' => '$5,000-$10,000', // <option value="5000to10000">$5,000-$10,000</option> | |
'morethan10000' => '> $10,000', // <option value="morethan10000">> $10,000</option> | |
) | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'RFP', | |
'file', | |
array( | |
'label' => 'Upload your RPF', | |
'hint' => 'This will only show for budgets above 5000.', | |
'depends' => array( array( 'id' => 'budget', 'value' => array('5000to10000', 'morethan10000') ) ), | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment