-
Notifications
You must be signed in to change notification settings - Fork 39
Project: Add option to limit field choices selection #2513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
419db81
131c38a
795be68
bd9f947
191299f
e4fd076
ea2ea27
055c1b7
de943ef
06102a9
c6872b7
fcf9770
5613edd
4e097eb
acb7bd1
9a3ff48
55c4931
53f1676
5931cad
9ac0c74
8bef115
b376cda
da17e00
b7b357a
ad7e2c2
e367bcf
3b8a3df
6d48545
e8aac0c
c497327
78ad919
c7709ea
574fd74
05f367a
6020eaf
6ec1d1c
9986575
f11b7ac
5050456
1d7d8e4
2ad0655
20976b9
bf4e6a3
3fe4eeb
799de54
8c5c69f
645aada
e1e3244
cda61bb
7c62ffe
0946032
db23bfc
e953057
471f39b
01de971
52d85eb
15b47f6
db58a4e
c6d5edd
4a385b3
ae6be8a
06418cb
2ed2690
50f3d5f
242c12a
c8f792d
d74ef56
bce1dc3
7b49acb
994471e
dc09bc3
9057e3d
87f0ec0
c2786f5
cc787a3
e347397
efc359a
338cd21
fcbca46
7d783ee
cba9039
03c62b2
2e899fb
6472959
eca4902
43b7e71
32b0c04
638848b
1200b96
b35fe1a
21c1222
038f926
77e0861
4b86627
5667907
b86c871
626562e
580a932
32c41c5
a240155
c86c146
cd6b75f
b1361c0
1fd31a8
a39eb33
6341144
a5f8d0b
39946a5
14e0f06
75eb854
23f215c
5ba0a83
699093d
1e011ec
00c8bed
d382ac5
6c64a19
d11b8af
9537362
507066a
59e3bc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -474,6 +474,14 @@ public static function get_error_msg( $field, $error ) { | |
| ), | ||
| ); | ||
|
|
||
| /** | ||
| * @since x.x | ||
| * | ||
| * @param array $defaults | ||
| * @param array|object $field | ||
| */ | ||
| $defaults = apply_filters( 'frm_default_field_validation_messages', $defaults, $field ); | ||
|
|
||
| $msg = FrmField::get_option( $field, $error ); | ||
| $msg = $msg ? $msg : $defaults[ $error ]['part']; | ||
| $msg = do_shortcode( $msg ); | ||
|
|
@@ -2798,4 +2806,85 @@ private static function get_ai_generate_options_button_class() { | |
| ) | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Checks if the field choice should be hidden due to choice limit being reached. | ||
| * | ||
| * @since x.x | ||
| * | ||
| * @param string $choice_key | ||
| * @param array $field | ||
| * | ||
| * @return bool | ||
| */ | ||
| public static function should_hide_field_choice( $choice_key, $field ) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AbdiTolesa I'm thinking
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Crabcyborg Actually, I was in favor of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @AbdiTolesa. I mostly want consistency. I think |
||
| /** | ||
| * @since x.x | ||
| * | ||
| * @param bool $hide_field_choice | ||
| * @param string $choice_key | ||
| * @param array $field | ||
| */ | ||
| return (bool) apply_filters( 'frm_hide_field_choice', false, $choice_key, $field ); | ||
| } | ||
|
|
||
| /** | ||
| * @since x.x | ||
| * | ||
| * @param array $field | ||
| * | ||
| * @return bool | ||
| */ | ||
| public static function should_skip_rendering_options_for_field( $field ) { | ||
| /** | ||
| * @since x.x | ||
| * | ||
| * @param bool $skip_rendering_options_for_field | ||
| * @param array $field | ||
| */ | ||
| return (bool) apply_filters( 'frm_should_skip_rendering_options_for_field', false, $field ); | ||
| } | ||
|
|
||
| /** | ||
| * Determine if 'disabled' attribute should be echoed in a field choice's HTML. | ||
| * | ||
| * @since x.x | ||
| * | ||
| * @param string $choice_key | ||
| * @param bool $is_selected_choice | ||
| * @param array $field | ||
| * | ||
| * @return bool | ||
| */ | ||
| public static function should_disable_option( $choice_key, $is_selected_choice, $field ) { | ||
| /** | ||
| * @since x.x | ||
| * | ||
| * @param bool $echo_disabled_attribute | ||
| * @param string $choice_key | ||
| * @param bool $is_selected_choice | ||
| * @param array $field | ||
| */ | ||
| return (bool) apply_filters( 'frm_disable_option', false, $choice_key, $is_selected_choice, $field ); | ||
| } | ||
|
|
||
| /** | ||
| * @since x.x | ||
| * | ||
| * @param array $field | ||
| * @param string $choice_key | ||
| * | ||
| * @return void | ||
| */ | ||
| public static function after_option_input( $field, $choice_key ) { | ||
| /** | ||
| * Allows adding content after checkbox, radio button, or dropdown fields. | ||
| * | ||
| * @since x.x | ||
| * | ||
| * @param array $field The field data. | ||
| * @param string $opt_key The option key. | ||
| */ | ||
| do_action( 'frm_after_option_input', $field, $choice_key ); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.