'; echo ' '; if ( $show_icon ) { echo ' ' . basename( get_attached_file( $escaped_value ) ); } else { echo wp_get_attachment_image( $escaped_value, 'thumbnail' ); } echo ''; } /** * Render content input field. */ public function callback( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { wp_enqueue_script( 'cmb2-uploader' ); $field_name = $field->_name(); $args = [ 'type' => 'checkbox', 'id' => $field_name, 'name' => $field_name, 'desc' => '', 'value' => 'on', ]; if ( $escaped_value == 'on' || $escaped_value == 1 ) { $args['checked'] = 'checked'; } $single = isset( $field->args['single'] ) && $field->args['single']; $attrs = $single ? "" : 'multiple="multiple"'; $size = ''; if ( isset( $field->args['accept'] ) && $field->args['accept'] ) { $attrs .= ' accept="' . $field->args['accept'] . '" '; $info = [ 'size' => opalestate_options( 'upload_other_max_size', 0.5 ), 'number' => opalestate_options( 'upload_other_max_files', 10 ), ]; $class = 'upload-file-wrap'; } else { $attrs .= ' accept="image/*" '; $class = 'upload-image-wrap'; $info = [ 'size' => opalestate_options( 'upload_image_max_size', 0.5 ), 'number' => opalestate_options( 'upload_image_max_files', 10 ), ]; } if ( $single ) { $info['number'] = 1; } $show_icon = isset( $field->args['show_icon'] ) && $field->args['show_icon'] ? $field->args['show_icon'] : false; ?>
$url ): ?>
render_image_or_icon( $key, $show_icon ); ?>
render_image_or_icon( $escaped_value, $show_icon ); ?>
args['value'] ) && (int) $field->args['value'] ): $image_id = $field->args['value']; ?>
render_image_or_icon( $image_id, $show_icon ); ?>
class="select-file" style="visibility: hidden;">

' . $info['size'] . '', '' . $info['number'] . '' ); ?>