* fix related to commit 945b79a97940406b40a5996f9aa2159bd11e29ab

This commit is contained in:
Mykyta Synelnikov
2024-11-11 18:53:17 +02:00
parent 4564175527
commit 920fb168dc
2 changed files with 20 additions and 20 deletions
+2 -4
View File
@@ -366,8 +366,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
*
* @return string
*/
function get_fields_by_row( $row_id ) {
public function get_fields_by_row( $row_id ) {
if ( empty( $this->global_fields ) || ! is_array( $this->global_fields ) ) {
$this->global_fields = array();
}
@@ -379,10 +378,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
}
}
return ( isset ( $results ) ) ? $results : '';
return isset( $results ) ? $results : '';
}
/**
* Get fields by sub row
*
+18 -16
View File
@@ -1,6 +1,8 @@
<?php
namespace um\core;
use Exception;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@@ -441,10 +443,14 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
* @param array $position
*/
private function add_field_from_predefined( $global_id, $form_id, $position = array() ) {
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
$field_scope = UM()->builtin()->predefined_fields;
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
if ( empty( $fields ) || ! is_array( $fields ) ) {
$fields = array();
}
if ( ! isset( $fields[ $global_id ] ) ) {
$field_scope = UM()->builtin()->predefined_fields;
$count = 1;
if ( ! empty( $fields ) ) {
$count = count( $fields ) + 1;
@@ -1624,7 +1630,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
* @param $key
*
* @return mixed
* @throws \Exception
* @throws Exception
*/
public function get_field( $key ) {
$fields = $this->get_fields();
@@ -2161,7 +2167,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
* @param array $args
*
* @return string|null
* @throws \Exception
* @throws Exception
*/
public function edit_field( $key, $data, $rule = false, $args = array() ) {
global $_um_profile_id;
@@ -4030,7 +4036,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
return $arr;
}
/**
* Get fields in row
*
@@ -4038,8 +4043,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
*
* @return string
*/
function get_fields_by_row( $row_id ) {
if ( ! isset( $this->get_fields ) ) {
public function get_fields_by_row( $row_id ) {
if ( ! isset( $this->get_fields ) || ! is_array( $this->get_fields ) ) {
return '';
}
@@ -4049,10 +4054,9 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
}
return ( isset ( $results ) ) ? $results : '';
return isset( $results ) ? $results : '';
}
/**
* Get fields by sub row
*
@@ -4119,7 +4123,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
* @param array $args
*
* @return string|null
* @throws \Exception
* @throws Exception
*/
public function display( $mode, $args ) {
$output = null;
@@ -4289,7 +4293,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
* @param bool $rule
*
* @return string|null
* @throws \Exception
* @throws Exception
*/
public function view_field( $key, $data, $rule = false ) {
if ( '_um_last_login' === $key ) {
@@ -4644,7 +4648,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
return apply_filters( "um_view_field_output_" . $data['type'], $data );
}
/**
* Display fields ( view mode )
*
@@ -4652,7 +4655,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
* @param array $args
*
* @return string|null
* @throws \Exception
* @throws Exception
*/
public function display_view( $mode, $args ) {
$output = null;
@@ -4664,7 +4667,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$this->set_mode = $mode;
$this->set_id = absint( $this->global_args['form_id'] );
$this->field_icons = ( isset( $this->global_args['icons'] ) ) ? $this->global_args['icons'] : 'label';
$this->field_icons = isset( $this->global_args['icons'] ) ? $this->global_args['icons'] : 'label';
// start output here
$this->get_fields = $this->get_fields();
@@ -4694,8 +4697,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
}
if ( ! empty( $this->get_fields ) ) {
if ( ! empty( $this->get_fields ) && is_array( $this->get_fields ) ) {
// find rows
foreach ( $this->get_fields as $key => $array ) {
if ( isset( $array['type'] ) && 'row' === $array['type'] ) {