echo form_field_dropdown($_field, $_options); } else { echo form_field($_field); } } else { echo form_field($_field); } break; // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- case 'file': case 'upload': $_field['bucket'] = isset($user_meta_cols[$field]['bucket']) ? $user_meta_cols[$field]['bucket'] : FALSE; if (isset(${'upload_error_' . $_field['key']})) { $_field['error'] = implode(' ', ${'upload_error_' . $_field['key']}); } echo form_field_mm($_field); break; // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- case 'string': default: echo form_field($_field); break; } } } else { echo '<p>' . lang('accounts_edit_meta_noeditable') . '</p>'; } ?> </fieldset>
<?php foreach ($product_types_meta as $id => $fields) { echo '<div class="meta-fields meta-fields-' . $id . '" style="display:none;">'; if ($fields) { // TODO: use the form builder library foreach ($fields as $field) { $_field = array(); $_field['key'] = 'variation[' . $_counter . '][meta][' . $field->key . ']'; $_field['label'] = !empty($field->label) ? $field->label : ''; $_field['placeholder'] = !empty($field->placeholder) ? $field->placeholder : ''; $_field['required'] = array_search('required', explode('|', $field->validation)) ? TRUE : FALSE; $_field['default'] = !empty($variation->meta->{$field->key}) ? $variation->meta->{$field->key} : ''; switch ($field->type) { case 'cdn_object': $_field['bucket'] = $field->bucket; $_field_out = form_field_mm($_field, $field->tip); break; // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- case 'text': default: $_field_out = form_field($_field, $field->tip); break; } echo $_field_out; } } else { echo '<p>There are no extra fields for this product type.</p>'; } echo '</div>'; }