/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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]; }
/** * 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; }
/** * 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; }
/** * 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; }