- changed form builder > icon field to new dropdown type;

This commit is contained in:
Mykyta Synelnikov
2024-04-17 17:55:21 +03:00
parent 9a4bf10df5
commit 595945c96e
21 changed files with 382 additions and 80 deletions
+61 -21
View File
@@ -1320,6 +1320,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
}
}
// Old interface for icon selector in UM admin forms field-type 'icon'.
if ( $this->init_icon ) {
include_once UM_PATH . 'includes/admin/templates/modal/forms/fonticons.php';
}
@@ -1554,12 +1555,50 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
break;
case '_icon':
if ( 'row' === $this->set_field_type ) {
$back = 'UM_edit_row';
?>
<p class="_heading_text">
<label for="_icon"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
<span class="um_admin_fonticon_wrapper">
$first_activation_date = get_option( 'um_first_activation_date', false );
// @todo new version
if ( empty( $first_activation_date ) || $first_activation_date >= 1713342395 || UM()->options()->get( 'enable_new_fonticons' ) ) {
UM()->setup()->set_icons_options();
$um_icons_list = get_option( 'um_icons_list' );
if ( 'row' === $this->set_field_type ) {
?>
<p class="_heading_text">
<label for="_icon"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
<select name="_icon" id="_icon" class="um-icon-select-field" data-placeholder="<?php esc_attr_e( 'Select Icon', 'ultimate-member' ); ?>" >
<option value=""><?php esc_html_e( 'Select Icon', 'ultimate-member' ); ?></option>
<?php if ( ! empty( $this->edit_mode_value ) && array_key_exists( $this->edit_mode_value, $um_icons_list ) ) { ?>
<option value="<?php echo esc_attr( $this->edit_mode_value ); ?>" selected><?php echo esc_html( $um_icons_list[ $this->edit_mode_value ]['label'] ); ?></option>
<?php } ?>
</select>
</p>
<?php } else { ?>
<div class="um-admin-tri">
<p>
<label for="_icon"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
<select name="_icon" id="_icon" class="um-icon-select-field" data-placeholder="<?php esc_attr_e( 'Select Icon', 'ultimate-member' ); ?>">
<option value=""><?php esc_html_e( 'Select Icon', 'ultimate-member' ); ?></option>
<?php if ( ! empty( $this->edit_mode_value ) && array_key_exists( $this->edit_mode_value, $um_icons_list ) ) { ?>
<option value="<?php echo esc_attr( $this->edit_mode_value ); ?>" selected><?php echo esc_html( $um_icons_list[ $this->edit_mode_value ]['label'] ); ?></option>
<?php } ?>
</select>
</p>
</div>
<?php
}
} else {
if ( 'row' === $this->set_field_type ) {
$back = 'UM_edit_row';
?>
<p class="_heading_text">
<label for="_icon"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
<span class="um_admin_fonticon_wrapper">
<a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo esc_attr( $back ); ?>"><?php esc_html_e( 'Choose Icon', 'ultimate-member' ); ?></a>
<span class="um-admin-icon-value"><?php if ( ! empty( $this->edit_mode_value ) ) { ?><i class="<?php echo esc_attr( $this->edit_mode_value ); ?>"></i><?php } else { ?><?php esc_html_e( 'No Icon', 'ultimate-member' ); ?><?php } ?></span>
@@ -1572,19 +1611,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
<?php } ?>
</span>
</p>
<?php
} else {
if ( $this->in_edit ) {
$back = 'UM_edit_field';
</p>
<?php
} else {
$back = 'UM_add_field';
}
?>
<div class="um-admin-tri">
<p>
<label for="_icon"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
<span class="um_admin_fonticon_wrapper">
if ( $this->in_edit ) {
$back = 'UM_edit_field';
} else {
$back = 'UM_add_field';
}
?>
<div class="um-admin-tri">
<p>
<label for="_icon"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
<span class="um_admin_fonticon_wrapper">
<a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo esc_attr( $back ); ?>"><?php esc_html_e( 'Choose Icon', 'ultimate-member' ); ?></a>
<span class="um-admin-icon-value"><?php if ( ! empty( $this->edit_mode_value ) ) { ?><i class="<?php echo esc_attr( $this->edit_mode_value ); ?>"></i><?php } else { ?><?php esc_html_e( 'No Icon', 'ultimate-member' ) ?><?php } ?></span>
@@ -1597,9 +1636,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
<?php } ?>
</span>
</p>
</div>
<?php
</p>
</div>
<?php
}
}
break;