From 2535c38cb80c2095d9c7b2e0af3d2150d111bb13 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Thu, 29 Jun 2023 21:53:29 +0300 Subject: [PATCH] - fix for user tags in hook; --- includes/core/class-fields.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index 69efa860..511d8568 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -3312,6 +3312,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { if ( isset( $data['options'] ) && is_array( $data['options'] ) ) { $options = $data['options']; } + $max_selections = isset( $data['max_selections'] ) ? absint( $data['max_selections'] ) : 0; $field_id = $key; @@ -3335,19 +3336,20 @@ if ( ! class_exists( 'um\core\Fields' ) ) { * @hook um_multiselect_option_value * * @param {int} $keyword If 1 - keyword is enabled. It's 0 by default. - * @param {string} $type Field Type. + * @param {string} $type Field type. Deprecated since 2.6.7 + * @param {array} $data Field data. Added since 2.6.7 * * @return {int} Enabled keyword. * * @example Change multiselect keyword data. Enable it. - * function my_multiselect_option_value( $keyword, $type ) { + * function my_multiselect_option_value( $keyword, $data ) { * // your code here * $keyword = 1; * return $keyword; * } * add_filter( 'um_multiselect_option_value', 'my_multiselect_option_value', 10, 2 ); */ - $use_keyword = apply_filters( 'um_multiselect_option_value', 0, $type ); + $use_keyword = apply_filters( 'um_multiselect_option_value', 0, $data ); $has_icon = ! empty( $data['icon'] ) && isset( $this->field_icons ) && 'field' === $this->field_icons;