Наследование: extends RWMB_Field
Пример #1
0
 /**
  * Get the attributes for a field
  *
  * @param array $field
  * @param mixed $value
  * @return array
  */
 static function get_attributes($field, $value = null)
 {
     $attributes = parent::get_attributes($field, $value);
     $attributes = wp_parse_args($attributes, array('data-options' => wp_json_encode($field['js_options'])));
     $attributes['type'] = 'text';
     return $attributes;
 }
Пример #2
0
 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $field = parent::normalize_field($field);
     $field['attributes']['type'] = 'password';
     $field['attributes']['class'] = 'rwmb-password';
     return $field;
 }
Пример #3
0
 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $field = parent::normalize_field($field);
     $field['multiple'] = false;
     $field['attributes']['id'] = false;
     return $field;
 }
Пример #4
0
 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $field = wp_parse_args($field, array('size' => 7, 'maxlength' => 7, 'pattern' => '^#+([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$', 'js_options' => array()));
     $field['js_options'] = wp_parse_args($field['js_options'], array('defaultColor' => false, 'hide' => true, 'palettes' => true));
     $field = parent::normalize_field($field);
     $field['attributes'] = wp_parse_args($field['attributes'], array('data-options' => wp_json_encode($field['js_options'])));
     return $field;
 }
Пример #5
0
 static function value($new, $old, $post_id, $field)
 {
     if ($new != $old) {
         return wp_hash_password(parent::value($new, $old, $post_id, $field));
     } else {
         return parent::value($new, $old, $post_id, $field);
     }
 }
Пример #6
0
 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $field = wp_parse_args($field, array('js_options' => array()));
     // Deprecate 'format', but keep it for backward compatible
     // Use 'js_options' instead
     $field['js_options'] = wp_parse_args($field['js_options'], array('showButtonPanel' => true, 'timeFormat' => empty($field['format']) ? 'HH:mm' : $field['format']));
     $field = parent::normalize_field($field);
     $field['attributes'] = wp_parse_args($field['attributes'], array('data-options' => wp_json_encode($field['js_options'])));
     return $field;
 }
Пример #7
0
 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $field = wp_parse_args($field, array('js_options' => array()));
     // Deprecate 'format', but keep it for backward compatible
     // Use 'js_options' instead
     $field['js_options'] = wp_parse_args($field['js_options'], array('dateFormat' => empty($field['format']) ? 'yy-mm-dd' : $field['format'], 'showButtonPanel' => true));
     if (isset($field['attributes'])) {
         $field['attributes'] = wp_parse_args($field['attributes'], array('data-options' => wp_json_encode($field['js_options'])));
     }
     $field = parent::normalize_field($field);
     $field['attributes']['class'] = 'rwmb-date';
     return $field;
 }
Пример #8
0
 /**
  * Get the attributes for a field
  *
  * @param array $field
  * @param mixed $value
  * @return array
  */
 static function get_attributes($field, $value = null)
 {
     $attributes = parent::get_attributes($field, $value);
     $attributes['type'] = 'password';
     return $attributes;
 }
Пример #9
0
 /**
  * Normalize parameters for field
  *
  * @param array $field
  * @return array
  */
 static function normalize($field)
 {
     $field = parent::normalize($field);
     $field['clone'] = true;
     $field['multiple'] = true;
     $field['attributes']['type'] = 'text';
     $field['placeholder'] = wp_parse_args((array) $field['placeholder'], array('key' => 'Key', 'value' => 'Value'));
     return $field;
 }
Пример #10
0
 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $field = parent::normalize_field($field);
     $field['attributes']['type'] = 'url';
     return $field;
 }
Пример #11
0
 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize($field)
 {
     $field = parent::normalize($field);
     $field['clone'] = true;
     $field['multiple'] = true;
     return $field;
 }
Пример #12
0
 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $field = parent::normalize_field($field);
     $field = wp_parse_args($field, array('pattern' => ''));
     return $field;
 }
Пример #13
0
 /**
  * Normalize parameters for field
  *
  * @param array $field
  * @return array
  */
 static function normalize($field)
 {
     $field = parent::normalize($field);
     $field['clone'] = true;
     $field['multiple'] = true;
     $field['attributes']['type'] = 'text';
     return $field;
 }