- fixed issues with the fields without metakeys;

- fixed integration issues for the fields without metakeys;
This commit is contained in:
nikitasinelnikov
2019-08-20 16:11:01 +03:00
parent c71a153afc
commit 3919b62c17
3 changed files with 46 additions and 62 deletions
+41 -32
View File
@@ -1215,6 +1215,45 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
}
/**
* Get all fields without metakeys
*
* @return array
*/
function get_fields_without_metakey() {
$fields_without_metakey = array(
'block',
'shortcode',
'spacing',
'divider',
'group'
);
/**
* UM hook
*
* @type filter
* @title um_fields_without_metakey
* @description Field Types without meta key
* @input_vars
* [{"var":"$types","type":"array","desc":"Field Types"}]
* @change_log
* ["Since: 2.0"]
* @usage add_filter( 'um_fields_without_metakey', 'function_name', 10, 1 );
* @example
* <?php
* add_filter( 'um_fields_without_metakey', 'my_fields_without_metakey', 10, 1 );
* function my_fields_without_metakey( $types ) {
* // your code here
* return $types;
* }
* ?>
*/
return apply_filters( 'um_fields_without_metakey', $fields_without_metakey );
}
/**
* May be used to show a dropdown, or source for user meta
*
@@ -1225,38 +1264,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
*/
function all_user_fields( $exclude_types = null, $show_all = false ) {
$fields_without_metakey = array(
'block',
'shortcode',
'spacing',
'divider',
'group'
);
$fields_without_metakey = apply_filters( 'um_fields_without_metakey', $fields_without_metakey );
remove_filter( 'um_fields_without_metakey', 'um_user_tags_requires_no_metakey' );
/**
* UM hook
*
* @type filter
* @title um_fields_without_metakey
* @description Extend Fields without metakey
* @input_vars
* [{"var":"$fields","type":"array","desc":"Fields without metakey"}]
* @change_log
* ["Since: 2.0"]
* @usage add_filter( 'um_fields_without_metakey', 'function_name', 10, 1 );
* @example
* <?php
* add_filter( 'um_fields_without_metakey', 'my_fields_without_metakey', 10, 1 );
* function my_fields_without_metakey( $fields ) {
* // your code here
* return $fields;
* }
* ?>
*/
$fields_without_metakey = apply_filters( 'um_fields_without_metakey', $fields_without_metakey );
$fields_without_metakey = $this->get_fields_without_metakey();
$fields_without_metakey = apply_filters( 'um_all_user_fields_without_metakey', $fields_without_metakey );
if ( ! $show_all ) {
$this->fields_dropdown = array('image','file','password','rating');