/** * 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('cols' => 60, 'rows' => 3, 'maxlength' => false, 'wrap' => false, 'readonly' => false, 'placeholder' => '')); $field['attributes'] = wp_parse_args($field['attributes'], array('cols' => $field['cols'], 'rows' => $field['rows'], 'maxlength' => $field['maxlength'], 'wrap' => $field['wrap'], 'readonly' => $field['readonly'], 'placeholder' => $field['placeholder'])); $field['attributes']['class'] .= ' large-text'; 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('datalist' => false, 'readonly' => false)); if ($field['datalist']) { $field['datalist'] = wp_parse_args($field['datalist'], array('id' => $field['id'] . '_list', 'options' => array())); } $field['attributes'] = wp_parse_args($field['attributes'], array('list' => $field['datalist'] ? $field['datalist']['id'] : false, 'readonly' => $field['readonly'])); return $field; }
/** * Normalize parameters for field * * @param array $field * * @return array */ static function normalize_field($field) { if (!$field['clone'] && $field['multiple']) { $field['field_name'] .= '[]'; } $field = parent::normalize_field($field); $field = wp_parse_args($field, array('size' => $field['multiple'] ? 5 : 0)); $field['attributes'] = wp_parse_args($field['attributes'], array('multiple' => $field['multiple'], 'size' => $field['size'])); 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('datalist' => false, 'disabled' => false, 'required' => false, 'readonly' => false)); if ($field['datalist']) { $field['datalist'] = wp_parse_args($field['datalist'], array('id' => $field['id'] . '_list', 'options' => array())); } $field['attributes'] = wp_parse_args($field['attributes'], array('disabled' => $field['disabled'], 'list' => $field['datalist'] ? $field['datalist']['id'] : false, 'readonly' => $field['readonly'], 'required' => $field['required'], 'name' => $field['field_name'], 'class' => "rwmb-{$field['type']}", 'id' => $field['clone'] ? false : $field['id'])); return $field; }