- fixed select2 styles;

- fixed icon selector inside the extensions;
This commit is contained in:
Mykyta Synelnikov
2023-11-14 13:09:00 +02:00
parent f0a16ea2fb
commit ddeb941d0c
15 changed files with 234 additions and 332 deletions
+14 -12
View File
@@ -534,29 +534,31 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
*
* @return bool|string
*/
function render_icon( $field_data ) {
public function render_icon( $field_data ) {
if ( empty( $field_data['id'] ) ) {
return false;
}
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
// Required modal scripts for proper functioning
UM()->admin()->enqueue()->load_modal();
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
$id_attr = ' id="' . esc_attr( $id ) . '" ';
$name = $field_data['id'];
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
$name_attr = ' name="' . $name . '" ';
$name = $field_data['id'];
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
$name_attr = ' name="' . esc_attr( $name ) . '" ';
$value = $this->get_field_value( $field_data );
$value_attr = ' value="' . $value . '" ';
$value = $this->get_field_value( $field_data );
$value_attr = ' value="' . esc_attr( $value ) . '" ';
$html = '<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="">' . __( 'Choose Icon', 'ultimate-member' ) . '</a>
$html = '<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="" data-icon_field="' . esc_attr( $id ) . '">' . esc_html__( 'Choose Icon', 'ultimate-member' ) . '</a>
<span class="um-admin-icon-value">';
if ( ! empty( $value ) ) {
$html .= '<i class="' . $value . '"></i>';
$html .= '<i class="' . esc_attr( $value ) . '"></i>';
} else {
$html .= __( 'No Icon', 'ultimate-member' );
$html .= esc_html__( 'No Icon', 'ultimate-member' );
}
$html .= '</span><input type="hidden" ' . $name_attr . ' ' . $id_attr . ' ' . $value_attr . ' />';
@@ -569,12 +571,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
$html .= '</span></span>';
// Required include the fonticons modal *.php file.
UM()->metabox()->init_icon = true;
return $html;
}
/**
* @param $field_data
*
+22 -18
View File
@@ -1546,18 +1546,21 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
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>
<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>
<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>
<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>
<input type="hidden" name="_icon" id="_icon" value="<?php echo ! empty( $this->edit_mode_value ) ? esc_attr( $this->edit_mode_value ) : ''; ?>" />
<input type="hidden" name="_icon" id="_icon" value="<?php echo ! empty( $this->edit_mode_value ) ? esc_attr( $this->edit_mode_value ) : ''; ?>" />
<?php if ( ! empty( $this->edit_mode_value ) ) { ?>
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
<?php } else { ?>
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
<?php } ?>
<?php if ( ! empty( $this->edit_mode_value ) ) { ?>
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
<?php } else { ?>
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
<?php } ?>
</span>
</p>
<?php
} else {
@@ -1570,18 +1573,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
<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>
<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>
<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>
<input type="hidden" name="_icon" id="_icon" value="<?php echo ! empty( $this->edit_mode_value ) ? esc_attr( $this->edit_mode_value ) : ''; ?>" />
<input type="hidden" name="_icon" id="_icon" value="<?php echo ! empty( $this->edit_mode_value ) ? esc_attr( $this->edit_mode_value ) : ''; ?>" />
<?php if ( ! empty( $this->edit_mode_value ) ) { ?>
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
<?php } else { ?>
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
<?php } ?>
<?php if ( ! empty( $this->edit_mode_value ) ) { ?>
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
<?php } else { ?>
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
<?php } ?>
</span>
</p>
</div>
<?php