상속: 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('step' => $field['step'], 'max' => $field['max'], 'min' => $field['min']));
     $attributes['type'] = 'number';
     return $attributes;
 }
예제 #2
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'] = 'checkbox';
     $attributes['list'] = false;
     return $attributes;
 }
예제 #3
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('size' => $field['size'], 'maxlength' => $field['maxlength'], 'pattern' => $field['pattern'], 'placeholder' => $field['placeholder']));
     $attributes['type'] = 'text';
     return $attributes;
 }
예제 #4
0
 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $field = parent::normalize_field($field);
     $field['attributes']['list'] = false;
     $field['attributes']['type'] = 'checkbox';
     return $field;
 }
예제 #5
0
 static function get_attributes($field, $value = null)
 {
     $attributes = RWMB_Input_Field::get_attributes($field, $value);
     $attributes['id'] = false;
     $attributes['type'] = 'radio';
     $attributes['value'] = $value;
     return $attributes;
 }
예제 #6
0
 /**
  * Get the attributes for a field
  *
  * @param array $field
  * @param mixed $value
  *
  * @return array
  */
 public static function get_attributes($field, $value = null)
 {
     $attributes = RWMB_Input_Field::get_attributes($field, $value);
     $attributes['id'] = false;
     $attributes['type'] = $field['multiple'] ? 'checkbox' : 'radio';
     $attributes['value'] = $value;
     return $attributes;
 }
예제 #7
0
파일: number.php 프로젝트: riopse/meta-box
 /**
  * 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('step' => 1, 'min' => 0, 'max' => false));
     $field['attributes'] = wp_parse_args($field['attributes'], array('step' => $field['step'], 'max' => $field['max'], 'min' => $field['min']));
     $field['attributes']['type'] = 'number';
     return $field;
 }
예제 #8
0
파일: text.php 프로젝트: riopse/meta-box
 /**
  * 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('size' => 30, 'maxlength' => false, 'pattern' => false, 'placeholder' => ''));
     $field['attributes'] = wp_parse_args($field['attributes'], array('size' => $field['size'], 'maxlength' => $field['maxlength'], 'pattern' => $field['pattern'], 'placeholder' => $field['placeholder']));
     $field['attributes']['type'] = 'text';
     return $field;
 }
예제 #9
0
 /**
  * Get the attributes for a field
  *
  * @param array $field
  * @param mixed $value
  *
  * @return array
  */
 static function get_attributes($field, $value = null)
 {
     switch ($field['field_type']) {
         case 'checkbox_list':
         case 'radio_list':
             $attributes = RWMB_Input_Field::get_attributes($field, $value);
             $attributes['class'] = "rwmb-choice";
             $attributes['id'] = false;
             $attributes['type'] = 'radio_list' === $field['field_type'] ? 'radio' : 'checkbox';
             break;
         case 'select_advanced':
             $attributes = RWMB_Select_Advanced_Field::get_attributes($field, $value);
             $attributes['class'] = "rwmb-choice rwmb-select_advanced";
             break;
         case 'select_tree':
             $attributes = RWMB_Select_Field::get_attributes($field, $value);
             $attributes['multiple'] = false;
             break;
         case 'select':
         default:
             $attributes = RWMB_Select_Field::get_attributes($field, $value);
             break;
     }
     $attributes['name'] .= !$field['clone'] && $field['multiple'] ? '[]' : '';
     return $attributes;
 }
예제 #10
0
파일: radio.php 프로젝트: Jebble/meta-box
 /**
  * Output the field value
  * Display option name instead of option value
  *
  * @use self::meta()
  *
  * @param  array    $field   Field parameters
  * @param  array    $args    Additional arguments. Rarely used. See specific fields for details
  * @param  int|null $post_id Post ID. null for current post. Optional.
  *
  * @return mixed Field value
  */
 static function the_value($field, $args = array(), $post_id = null)
 {
     $value = parent::get_value($field, $args, $post_id);
     return empty($value) ? '' : $field['options'][$value];
 }
예제 #11
0
 /**
  * Get meta value
  *
  * @param int   $post_id
  * @param bool  $saved
  * @param array $field
  *
  * @return mixed
  */
 static function meta($post_id, $saved, $field)
 {
     $meta = parent::meta($post_id, $saved, $field);
     if (is_array($meta)) {
         foreach ($meta as $key => $value) {
             $meta[$key] = $field['timestamp'] && $value ? date(self::translate_format($field), intval($value)) : $value;
         }
     } else {
         $meta = $field['timestamp'] && $meta ? date(self::translate_format($field), intval($meta)) : $meta;
     }
     return $meta;
 }
예제 #12
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'] = 'hidden';
     return $attributes;
 }
예제 #13
0
파일: hidden.php 프로젝트: riopse/meta-box
 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $field = parent::normalize_field($field);
     $field['attributes'] = array('name' => $field['field_name'], 'id' => $field['clone'] ? false : $field['id']);
     return $field;
 }