mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
New field type: Number
This commit is contained in:
@@ -1247,6 +1247,26 @@ class UM_Admin_Metabox {
|
||||
<?php
|
||||
break;
|
||||
|
||||
case '_min':
|
||||
?>
|
||||
|
||||
<p><label for="_min">Minimum Number <?php $this->tooltip( __('Minimum number that can be entered in this field','ultimatemember') ); ?></label>
|
||||
<input type="text" name="_min" id="_min" value="<?php echo $this->edit_mode_value; ?>" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
break;
|
||||
|
||||
case '_max':
|
||||
?>
|
||||
|
||||
<p><label for="_max">Maximum Number <?php $this->tooltip( __('Maximum number that can be entered in this field','ultimatemember') ); ?></label>
|
||||
<input type="text" name="_max" id="_max" value="<?php echo $this->edit_mode_value; ?>" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
break;
|
||||
|
||||
case '_min_chars':
|
||||
?>
|
||||
|
||||
|
||||
@@ -381,6 +381,7 @@ p.um-notice.warning {
|
||||
}
|
||||
|
||||
.um-form input[type=text],
|
||||
.um-form input[type=number],
|
||||
.um-form input[type=password] {
|
||||
padding: 0 12px !important;
|
||||
width: 100%;
|
||||
@@ -399,7 +400,14 @@ p.um-notice.warning {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
.um-form input[type=number] {
|
||||
width: auto;
|
||||
padding: 0 0 0 5px !important;
|
||||
height: 30px !important;
|
||||
}
|
||||
|
||||
.um-form input[type=text]:focus,
|
||||
.um-form input[type=number]:focus,
|
||||
.um-form input[type=password]:focus,
|
||||
.um-form textarea:focus {
|
||||
box-shadow: none !important;
|
||||
@@ -560,7 +568,8 @@ p.um-notice.warning {
|
||||
.um div.disabled,
|
||||
.um-disabled,
|
||||
.um input[type=submit]:disabled,
|
||||
.um input[type=text]:disabled {
|
||||
.um input[type=text]:disabled,
|
||||
.um input[type=number]:disabled {
|
||||
opacity: 0.6 !important;
|
||||
cursor: no-drop !important;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -146,6 +146,7 @@ print ".um-$form_id.um .um-button.um-alt,
|
||||
if ( $form_border ) {
|
||||
print "
|
||||
.um-$form_id.um .um-form input[type=text],
|
||||
.um-$form_id.um .um-form input[type=number],
|
||||
.um-$form_id.um .um-form input[type=password],
|
||||
.um-$form_id.um .um-form textarea,
|
||||
.um-$form_id.um .upload-progress,
|
||||
@@ -166,6 +167,7 @@ print "
|
||||
if ( $form_border_hover ) {
|
||||
print "
|
||||
.um-$form_id.um .um-form input[type=text]:focus,
|
||||
.um-$form_id.um .um-form input[type=number]:focus,
|
||||
.um-$form_id.um .um-form input[type=password]:focus,
|
||||
.um-$form_id.um .um-form textarea:focus {
|
||||
border: $form_border_hover !important;
|
||||
@@ -176,6 +178,7 @@ print "
|
||||
if ( $form_bg_color ) {
|
||||
print "
|
||||
.um-$form_id.um .um-form input[type=text],
|
||||
.um-$form_id.um .um-form input[type=number],
|
||||
.um-$form_id.um .um-form input[type=password],
|
||||
.um-$form_id.um .um-form textarea,
|
||||
.select2-container .select2-choice,
|
||||
@@ -189,6 +192,7 @@ print "
|
||||
if ( $form_bg_color_focus ) {
|
||||
print "
|
||||
.um-$form_id.um .um-form input[type=text]:focus,
|
||||
.um-$form_id.um .um-form input[type=number]:focus,
|
||||
.um-$form_id.um .um-form input[type=password]:focus,
|
||||
.um-$form_id.um .um-form textarea:focus {
|
||||
background-color: $form_bg_color_focus;
|
||||
|
||||
@@ -147,6 +147,22 @@ class UM_Builtin {
|
||||
)
|
||||
),
|
||||
|
||||
'number' => array(
|
||||
'name' => __('Number','ultimatemember'),
|
||||
'col1' => array('_title','_metakey','_help','_default','_min','_visibility'),
|
||||
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate','_max'),
|
||||
'col3' => array('_required','_editable','_icon'),
|
||||
'validate' => array(
|
||||
'_title' => array(
|
||||
'mode' => 'required',
|
||||
'error' => __('You must provide a title','ultimatemember')
|
||||
),
|
||||
'_metakey' => array(
|
||||
'mode' => 'unique',
|
||||
),
|
||||
)
|
||||
),
|
||||
|
||||
'textarea' => array(
|
||||
'name' => 'Textarea',
|
||||
'col1' => array('_title','_metakey','_help','_height','_max_chars','_max_words','_visibility'),
|
||||
|
||||
@@ -623,6 +623,12 @@ class UM_Fields {
|
||||
|
||||
break;
|
||||
|
||||
case 'number':
|
||||
|
||||
$array['disabled'] = '';
|
||||
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
|
||||
$array['input'] = 'text';
|
||||
@@ -990,6 +996,34 @@ class UM_Fields {
|
||||
|
||||
$output .= '</div>';
|
||||
break;
|
||||
|
||||
/* Number */
|
||||
case 'number':
|
||||
|
||||
$output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="'.$key.'">';
|
||||
|
||||
if ( isset( $data['label'] ) ) {
|
||||
$output .= $this->field_label($label, $key, $data);
|
||||
}
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
if ( isset($icon) && $icon && isset( $this->field_icons ) && $this->field_icons == 'field' ) {
|
||||
|
||||
$output .= '<div class="um-field-icon"><i class="'.$icon.'"></i></div>';
|
||||
|
||||
}
|
||||
|
||||
$output .= '<input '.$disabled.' class="'.$this->get_class($key, $data).'" type="number" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. htmlspecialchars( $this->field_value( $key, $default, $data ) ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" min="' . $min . '" max="' . $max . '" />
|
||||
|
||||
</div>';
|
||||
|
||||
if ( $this->is_error($key) ) {
|
||||
$output .= $this->field_error( $this->show_error($key) );
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
break;
|
||||
|
||||
/* Password */
|
||||
case 'password':
|
||||
|
||||
Reference in New Issue
Block a user